Skip to content

One optional path parameter marks all param as optional #2574

@NamesMT

Description

@NamesMT

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions