You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tighter parameter decorator checking with --experimentalDecorators #52435
Unable to resolve signature of parameter decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'string | symbol'
changed the title [-]Decorator call resolution regression with `--experimentalDecorators`[/-][+]Decorator call regression with `--experimentalDecorators`[/+]on Jan 26, 2023
Yes, it seems this was a bug in type-checking parameter decorators on constructors under --experimentalDecorators with TypeScript 4.9 and prior.
In #50820, we fixed up the way we type-checked decorators. This catches some issues, like decorators which expect a defined key; however, parameter decorators in constructors don't get passed a key. As a result, libraries with dependency injection decorator functions like inversify (pre-6.0), NestJS, and others (often named inject, Inject, and InjectRepository) might need to be corrected to accept an undefined key (or to have an overload which accepts an undefined key).
changed the title [-]Decorator call regression with `--experimentalDecorators`[/-][+]Tighter parameter decorator checking with `--experimentalDecorators`[/+]on Jan 26, 2023
Activity
DanielRosenwasser commentedon Jan 26, 2023
Was this...possibly always a bug with
--experimentalDecorators?[-]Decorator call resolution regression with `--experimentalDecorators`[/-][+]Decorator call regression with `--experimentalDecorators`[/+]DanielRosenwasser commentedon Jan 26, 2023
Yes, it seems this was a bug in type-checking parameter decorators on constructors under
--experimentalDecoratorswith TypeScript 4.9 and prior.In #50820, we fixed up the way we type-checked decorators. This catches some issues, like decorators which expect a defined
key; however, parameter decorators in constructors don't get passed a key. As a result, libraries with dependency injection decorator functions like inversify (pre-6.0), NestJS, and others (often namedinject,Inject, andInjectRepository) might need to be corrected to accept anundefinedkey (or to have an overload which accepts anundefinedkey).[-]Decorator call regression with `--experimentalDecorators`[/-][+]Tighter parameter decorator checking with `--experimentalDecorators`[/+]rbuckton commentedon Jan 26, 2023
inversify's@injectworks fine starting ininversify@6.0.1.@nestjs/common's@injectneeds to be updated, however.kevinlul commentedon Jan 27, 2023
Is tsyringe affected?
DanielRosenwasser commentedon Jan 27, 2023
Yes, I believe so.
DanielRosenwasser commentedon Jan 27, 2023
I filed an issue at NestJS over at #52435. I'm not sure how active TSyringe is at the moment.
typescript-bot commentedon Jan 29, 2023
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
Evaldoes commentedon Jan 7, 2024
I was able to solve this problem by adding these parameters to the
tsconfig.jsonfile:I used
inversify: 6.0.1versionNOTE: when I inserted it at the end of the file it didn't work, only when I put it at the beginning
I hope I can help 😄