diff --git a/deno_dist/request.ts b/deno_dist/request.ts index 4d353a00b..ea1825379 100644 --- a/deno_dist/request.ts +++ b/deno_dist/request.ts @@ -79,6 +79,7 @@ export class HonoRequest

{ param> = RemoveQuestion>>( key: P2 ): string | undefined + param(key: string): string | undefined param(): UnionToIntersection>> param(key?: string): unknown { return key ? this.getDecodedParam(key) : this.getAllDecodedParams() diff --git a/src/hono.test.ts b/src/hono.test.ts index 02429274f..3a79dac82 100644 --- a/src/hono.test.ts +++ b/src/hono.test.ts @@ -856,8 +856,6 @@ describe('param and query', () => { describe('param with undefined', () => { const app = new Hono() app.get('/foo/:foo', (c) => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - /* @ts-ignore */ const bar = c.req.param('bar') return c.json({ foo: bar }) }) diff --git a/src/request.ts b/src/request.ts index fa748c5f1..b5fd8546e 100644 --- a/src/request.ts +++ b/src/request.ts @@ -79,6 +79,7 @@ export class HonoRequest

{ param> = RemoveQuestion>>( key: P2 ): string | undefined + param(key: string): string | undefined param(): UnionToIntersection>> param(key?: string): unknown { return key ? this.getDecodedParam(key) : this.getAllDecodedParams()