Reputation: 125
A program I am getting to know the codebase of uses a DecorateAndBind function. While running tests, I got the error message TypeError: Reflect.decorate is not a function
. Since this didn't seem to come from anything the team here has written themselves, I investigated.
At some point the program calls upon a decorate function in the Inversify module. To be precise it's in node_modules/inversify/dts/annotation/decorator_utils.d.ts
. In the corresponding .js
file this refers to Reflect.decorate. I can trace the definition of Reflect to a different module, node_modules/typescript/lib/lib.es2015.reflect.d.ts
. In this file, Reflect.decorate is not declared.
What can I do to fix this error? I think I shouldn't edit node_modules files myself. Is the initial call to the decorate function in Inversify wrong?
Upvotes: 1
Views: 2848
Reputation: 59
You mentioned installing reflect-metadata, but did you also import it? import "reflect-metadata";
Upvotes: 2