nest
nest copied to clipboard
Fixed type error in apply-decorators.ts
trafficstars
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- [x] Tests for the changes have been added (for bug fixes / features)
- [x] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [x] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Other... Please describe:
What is the current behavior?
Throws typescript error
Argument of type 'string | symbol | undefined' is not assignable to parameter of type 'string | symbol'.
Type 'undefined' is not assignable to type 'string | symbol'
Here:
Because typescript definitions of Decorator types are as follows:
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
What is the new behavior?
Doesn't throw an error
Does this PR introduce a breaking change?
- [ ] Yes
- [x] No
Apply-decorators were introduced here https://github.com/nestjs/nest/pull/3113