diff --git a/packages/http-router/src/Router.ts b/packages/http-router/src/Router.ts index 7585cd0090224..d9916247f7226 100644 --- a/packages/http-router/src/Router.ts +++ b/packages/http-router/src/Router.ts @@ -194,7 +194,13 @@ export class Router< const [middlewares, action] = splitArray(actions); const convertedAction = this.convertActionToHandler(action); - this.innerRouter[method.toLowerCase() as Lowercase](`/${subpath}`.replace('//', '/'), ...middlewares, async (c) => { + type RouteMethod = (path: string, ...handlers: MiddlewareHandler[]) => unknown; + const methodKey = method.toLowerCase() as keyof typeof this.innerRouter; + + (this.innerRouter as unknown as Record)[methodKey]( + `/${subpath}`.replace('//', '/'), + ...middlewares, + async (c: Context) => { const { req, res } = c; const queryParams = this.parseQueryParams(req);