Search code examples
angulartypescriptangular12

Reflect-metadata errors after upgrade to angular 12


Angular 12 autoupdate removes "emitDecoratorMetadata": true property from tsconfig.json and dev-version (ng serve) of app has error:

ERROR Error: Uncaught (in promise): TypeError: can't access property "name", d is undefined

at vendor.js file at this place:

... d=Reflect.getMetadata("design:type",e,r),v=!!d.name&&d.name.toLowerCase()===t.Array ...

Production build doesn't has this error

Including "emitDecoratorMetadata": true at tsconfig.json eliminates this error

Installing and including polyfill reflect-metadata doesn't help

Temporary solution: include "emitDecoratorMetadata": true, but this is deprecated.


Solution

  • It's outside dependency error, and it strictly requires emitDecoratorMetadata set to true.