-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move ctor param info from global map to metadata. Fixes #161 #204
Conversation
Another important note to take here is that no reflection polyfill is allowed to be imported inside the linked library. If reflection methods are required by the library itself, the types can be declared like in https://github.com/rbuckton/reflect-metadata/blob/master/Reflect.d.ts |
Hey @Xapphire13 @MeltingMosaic, any chances this could get merged? |
Definitely would like to get this merged in. |
Added this to tsyringe-neo |
Any news on this? |
Well, actually, two years in I now know the true root cause for this issue. My original PR here removed the global from the tsyringe library, and implicitly used the global of the reflection polyfill. Possibly this could be resolved with the In the mean time, you could workaround this by linking the tsyringe dependency from the main project into the library. shared-logic$ npm link ../backend/node_modules/tsyringe Now booth projects point to the same tsyringe dependency, the one in Hope this helps! 😊 |
Thank you for keeping it alive @risen228 @florian-g2 Just an fyi,I opened an issue (#248) regarding the state of the repo and was fortunate enough to receive a response |
Hi there.
This PR moves the paramInfos acquired by the
injectable()
decorator from the global typeInfo map to constructor/class metadata.That fixes a
TypeInfo not known for ...
bug occurring in an environment where a library with injectable dependencies is linked using symlinks (npm-link).In this special environment, globals are not shared between the library and the main project, therefore the typeInfos populated by the injectable() decorator weren't accessible before to the main project.
Due to this unfavorable side-effect of the npm-link, the
registry()
andautoInjectable()
decorators will still be broken because their functionalities require direct access to the global container instance.Minimal repo reproducing the issue in the initial commit: https://github.com/florian-g2/npm-link-missing-globals