diff --git a/lib/decorators/helpers.ts b/lib/decorators/helpers.ts index c5ae66a59..75c8ba4a6 100644 --- a/lib/decorators/helpers.ts +++ b/lib/decorators/helpers.ts @@ -173,6 +173,10 @@ export function createParamDecorator = any>( continue; } + if (!methodDescriptor.value) { + continue; + } + const isApiMethod = Reflect.hasMetadata( METHOD_METADATA, methodDescriptor.value diff --git a/test/decorators/api-query.decorator.spec.ts b/test/decorators/api-query.decorator.spec.ts index aed9c474e..e744d7eb9 100644 --- a/test/decorators/api-query.decorator.spec.ts +++ b/test/decorators/api-query.decorator.spec.ts @@ -13,6 +13,10 @@ describe('ApiQuery', () => { } public noAPiMethod(): void {} + + public get service() { + return null; + } } it('should attach metadata to all API methods', () => {