honojs/hono

One optional path parameter marks all param as optional

Closed this issue · 0 comments

What version of Hono are you using?

4.2.9

What runtime/platform is your app running on?

Node v20

What steps can reproduce the bug?

Declare a route like /api/:a/:b?

What is the expected behavior?

c.req.param('a') should be string, only c.req.param('b') should be nullable

What do you see instead?

c.req.param('a') (and 'b') is be typed as string | undefined

Additional information

No response