Skip to content

Commit

Permalink
Merge pull request #10970 from nestjs/fix/inject-decorator-signature
Browse files Browse the repository at this point in the history
fix(common): inject decorator should allow key to be undefined
  • Loading branch information
kamilmysliwiec authored Feb 1, 2023
2 parents b4d6c13 + 24a07d2 commit 268d930
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/common/decorators/core/inject.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { isUndefined } from '../../utils/shared.utils';
* @publicApi
*/
export function Inject<T = any>(token?: T) {
return (target: object, key: string | symbol, index?: number) => {
return (target: object, key: string | symbol | undefined, index?: number) => {
const type = token || Reflect.getMetadata('design:type', target, key);

if (!isUndefined(index)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/decorators/core/optional.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { isUndefined } from '../../utils/shared.utils';
* @publicApi
*/
export function Optional() {
return (target: object, key: string | symbol, index?: number) => {
return (target: object, key: string | symbol | undefined, index?: number) => {
if (!isUndefined(index)) {
const args = Reflect.getMetadata(OPTIONAL_DEPS_METADATA, target) || [];
Reflect.defineMetadata(OPTIONAL_DEPS_METADATA, [...args, index], target);
Expand Down

0 comments on commit 268d930

Please sign in to comment.