Angular cli build prod: TypeError: Cannot read property 'kind' of undefined

This problem occurs by so many cases, one of the major reasons is installed version of @angular/cli is different to globally installed version of @angular/cli Make sure that both are same version. In other cases you have to update the devkit.

Please have a look on these threads, you will get an idea:

  1. https://github.com/angular/angular-cli/issues/13172
  2. https://github.com/angular/angular-cli/issues/13861

Keep in mind now TypeScript 3.6.4 is out. Still, it's ok to read below what wasn't really working.

TypeScript <= 3.6.3 presents this issue, Handle parentless nodes in isParameterPropertyDeclaration.

If you install 3.7 (dev or the new beta), it will compile fine.


Note: if you receive an ERROR on building, regarding the TS version, just disable it via tsconfig.
For that use disableTypeScriptVersionCheck

"angularCompilerOptions": {
  "disableTypeScriptVersionCheck": true
},
"compilerOptions": {
 ...

Follow the comment's chat if any other problem emerges.


Although the question specifically states isParameterPropertyDeclaration as the source of the error, this question is the only one linked by Google when searching for the following very similar error:

ERROR in ./node_modules/some_library/...
Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js):
TypeError: Cannot read property 'kind' of undefined

Since I couldn't find any good answer for the error above, I'm posting it here for reference.

If you're using a library affected by this error, you should upgrade your @angular/cli version to 8 or disable optimization in production mode (to disable optimization, change projects.your_project_name.architect.build.configurations.production.optimization from true to false).

If you're a library owner trying to fully support versions 6 and 7 of Angular, in the tsconfig.json of your library, set compilerOptions.emitDecoratorMetadata to true and recompile. Since now you're exporting all metadata from the decorators, Angular will do .kind of the exported metadata, fixing the problem where it was undefined.