Change ParamaterDecorator to allow an undefined propertyKey#53365
Change ParamaterDecorator to allow an undefined propertyKey#53365rbuckton merged 1 commit intomicrosoft:mainfrom
Conversation
`propertyKey` argument can be undefined for parameter decorators
|
(ignore the close/open; just fixing CI after I broke/unbroke main 🙃) |
|
OK! I was worried I did something wrong to have the tests break like that. 😌 |
|
This needs a backport to 5.0, right? @DanielRosenwasser |
|
@DanielRosenwasser: we may want to include this if we do any follow-up 5.0.x patches. It is a potentially breaking change, but is in line with the correctness change we made for parameter decorators that we mention in the 5.0 release notes. |
|
@typescript-bot cherry-pick this to release-5.0 |
|
Heya @jakebailey, I've started to run the task to cherry-pick this into |
|
Hey @jakebailey, I've opened #53392 for you. |
Component commits: 2c400b7 Update decorators.legacy.d.ts `propertyKey` argument can be undefined for parameter decorators
|
Technically any library that exports a `ParameterDecorator is potentially "wrong" today; but on the other hand, any existing code is probably sufficiently working anyway. So I think a cherry-pick is reasonable because it should unblock consumers, while helping library authors adapt. |
…e-5.0 (#53392) Co-authored-by: Daniel Hritzkiv <daniel.hritzkiv@gmail.com>
…to release-5.0 (microsoft#53392) Co-authored-by: Daniel Hritzkiv <daniel.hritzkiv@gmail.com>
propertyKeyargument can be undefined for constructor parameter decorators.I believe changes between 4.9 and 5.0 tightened up decorator type checking in some areas (#52435), while a newly introduced declaration file for legacy decorators doesn't reflect this change.
After upgrading to 5.0, I noticed that in my code, a dependency's usage of
ParameterDecoratorresulted in a type checking warning:Changing the
propertyKeyindecorators.legacy.d.tsto allowundefinedfixed the type-checking error.I did not touch the other Decorator types as I don't know if the
propertyKeyissue affects them in the same way.Fixes #53312