reflect-metadata specific version needed?
See original GitHub issueI’m submitting a request
Current behavior
NestJs currently seems to depend on a specific version of reflect-metadata
(0.1.10) and will complain in NPM unless you resolve this SPECIFIC version, I tried higher versions and it complained it needed that specific one.
Expected behavior
It should ideally not need any specific polyfill for Reflect.getMetadata
etc it should just expect the consumer to provide one (until nodejs etc) doesn’t need it polyfilled.
Currently to my knowledge there are 2 available polyfills:
- core-js
- reflect-metadata
Problem here is if you were to have both of them in a project your metadata gets wiped as each polyfill is replacing each others polyfill (this may be fixed now but was an issue a few months back).
Minimal reproduction of the problem with instructions
- Make a new project
- Add restjs dependencies
- See error for missing
reflect-metadata
0.1.10 - install 0.1.12 version of
reflect-metadata
- See error for missing
reflect-metadata
0.1.10
What is the motivation / use case for changing the behavior?
It just seemed odd that it should force you to use a specific version of a polyfill, and in some cases people may want to use core-js
which would probably cause decorators that use metadata to blow up.
Recommended solution?
I would remove the dependency on reflect-metadata
entirely, and just include a devDependency
for @types/reflect-metadata
, that will allow you to write TS code that uses metadata, then you require the consumer to provide a relevant polyfill (as listed above).
This is done on one of my other libs:
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:5 (2 by maintainers)
Top GitHub Comments
Hey @grofit, Thanks for reporting! This issue is fixed in
v5.0.0
(currentlyv5.0.0-beta.2
).This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.