From be000be1a0d41a39f65bf2c245a979ce88fc9cd9 Mon Sep 17 00:00:00 2001 From: Alan Bridgeman Date: Mon, 12 Jan 2026 20:51:17 -0600 Subject: [PATCH] Provided diagnosis is correct had issues because of an improper falsy check (which is why given the choice, I prefere strictly typed languages) --- src/decorators/Controller.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/decorators/Controller.ts b/src/decorators/Controller.ts index 732ff17..346ad84 100644 --- a/src/decorators/Controller.ts +++ b/src/decorators/Controller.ts @@ -104,7 +104,7 @@ export function Controller(b // Loop over all the methods in the decorated class looking for methods that use the GET decorator Object.getOwnPropertyNames(target.prototype) // Find all methods that have a Get metadata key (GET decorator) - .filter((method) => Reflect.getMetadata(GET_METADATA_KEY, target.prototype, method)) + .filter((method) => typeof Reflect.getMetadata(GET_METADATA_KEY, target.prototype, method) !== 'undefined') .map((method) => { // Get the method let fn = target.prototype[method]; @@ -165,7 +165,7 @@ export function Controller(b // Loop over all the methods in the decorated class looking for methods that use the POST decorator Object.getOwnPropertyNames(target.prototype) // Find all methods that have a Post metadata key (POST decorator) - .filter((method) => Reflect.getMetadata(POST_METADATA_KEY, target.prototype, method)) + .filter((method) => typeof Reflect.getMetadata(POST_METADATA_KEY, target.prototype, method) !== 'undefined') .map((method) => { // Get the method const fn = target.prototype[method]; @@ -217,7 +217,7 @@ export function Controller(b // Loop over all the methods in the decorated class looking for methods that use the `@PUT` decorator Object.getOwnPropertyNames(target.prototype) // Find all methods that have the associated metadata key (`@PUT` decorator) - .filter((method) => Reflect.getMetadata(PUT_METADATA_KEY, target.prototype, method)) + .filter((method) => typeof Reflect.getMetadata(PUT_METADATA_KEY, target.prototype, method) !== 'undefined') .map((method) => { // Get the method const fn = target.prototype[method]; @@ -264,7 +264,7 @@ export function Controller(b // Loop over all the methods in the decorated class looking for methods that use the `@DELETE` decorator Object.getOwnPropertyNames(target.prototype) // Find all methods that have the associated metadata key (`@DELETE` decorator) - .filter((method) => Reflect.getMetadata(DELETE_METADATA_KEY, target.prototype, method)) + .filter((method) => typeof Reflect.getMetadata(DELETE_METADATA_KEY, target.prototype, method) !== 'undefined') .map((method) => { // Get the method const fn = target.prototype[method];