Skip to content

Commit

Permalink
Merge pull request #11318 from skrtheboss/fix/inject-and-optional-dec…
Browse files Browse the repository at this point in the history
…orator-typings

fix(common): fix @Inject and @optional return types
  • Loading branch information
kamilmysliwiec authored Apr 5, 2023
2 parents 03aa13e + ffc09ee commit 5aab28f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/common/decorators/core/inject.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ import { isUndefined } from '../../utils/shared.utils';
*
* @publicApi
*/
export function Inject<T = any>(token?: T) {
export function Inject<T = any>(
token?: T,
): PropertyDecorator & ParameterDecorator {
return (target: object, key: string | symbol | undefined, index?: number) => {
const type = token || Reflect.getMetadata('design:type', target, key);

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 @@ -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) || [];
Expand Down

0 comments on commit 5aab28f

Please sign in to comment.