From ffc09ee82c5462742c8aaf3c9891e779ed7b040d Mon Sep 17 00:00:00 2001 From: skrtheboss Date: Wed, 22 Mar 2023 09:08:41 +0100 Subject: [PATCH] fix(common): adjust @inject and @optional return types Use PropertyDecorator and ParameterDecorator as return type to ensure typings are correct --- packages/common/decorators/core/inject.decorator.ts | 4 +++- packages/common/decorators/core/optional.decorator.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/common/decorators/core/inject.decorator.ts b/packages/common/decorators/core/inject.decorator.ts index 8eba6c15025..e8f559124a6 100644 --- a/packages/common/decorators/core/inject.decorator.ts +++ b/packages/common/decorators/core/inject.decorator.ts @@ -33,7 +33,9 @@ import { isUndefined } from '../../utils/shared.utils'; * * @publicApi */ -export function Inject(token?: T) { +export function Inject( + token?: T, +): PropertyDecorator & ParameterDecorator { return (target: object, key: string | symbol | undefined, index?: number) => { const type = token || Reflect.getMetadata('design:type', target, key); diff --git a/packages/common/decorators/core/optional.decorator.ts b/packages/common/decorators/core/optional.decorator.ts index 69f88ceafd3..0d94c20f000 100644 --- a/packages/common/decorators/core/optional.decorator.ts +++ b/packages/common/decorators/core/optional.decorator.ts @@ -17,7 +17,7 @@ import { isUndefined } from '../../utils/shared.utils'; * * @publicApi */ -export function Optional() { +export function Optional(): PropertyDecorator & ParameterDecorator { return (target: object, key: string | symbol | undefined, index?: number) => { if (!isUndefined(index)) { const args = Reflect.getMetadata(OPTIONAL_DEPS_METADATA, target) || [];