using reflect-metadata version 0.1.9 broke property injection in my project.
@injectable()
export class CoreConfig implements IConfig {
@inject(IContext)
context: IContext;
}
Error:
Uncaught TypeError: Cannot assign to read only property 'context' of object '#<CoreConfig>'
Didn't tried to investigate further, though. Maybe it's just a bug in this version. Cheers!
PS: using v0.1.8 works fine!
Hi @endel can you please try with 3.0.0-rc.4?
Hey @remojansen, the version I'm using is 2.0.1, actually. I need to upgrade our framework to use 3.0.0, will do it this week possibly!
I am facing the same issue with reflect-metadata v0.1.9.
After reading release notes for that version, I see no breaking changes (cc @rbuckton).
As it is affecting a release version, wouldn't it be good to publish a hotfix forcing version of reflect-metadata at max v0.1.8 ?
Thanks @endel for reporting it and for the temporary solution!
I was investigating this issue for quite some hours and was not suspecting reflect-metadata at all!
You saved me some other debugging session hours!
PS: I am wondering why inversifyJS doesn't have reflect-metadata in its dependencies. Can someone please help me understanding ? Thanks :)
For the moment the recommended solution is using:
0.1.8 + 2.0.1.0.1.0 + 3.0.0-rc.4.The 3.0.0-rc.4 release will become 3.0.0 very soon.
Hi @fdnhkj inversifyJS doesn't have reflect-metadata in its dependencies because it is a polyfill. At some point, some JS engines will not require it so it is an optional dependency.
I have been able to find a work around for this problem, by replacing
lib/resolution/instantiation.js: line 14
instance[propertyName] = injection;
with
Object.defineProperty(instance, propertyName, { value: injection });
it works fine for me.
[email protected] has now been released and it works with [email protected]
Most helpful comment
[email protected]has now been released and it works with[email protected]