hono
hono copied to clipboard
c.req.valid() showing some errors when using validator module in a route
What version of Hono are you using?
4.1.4
What runtime/platform is your app running on?
Bun
What steps can reproduce the bug?
ts error is raised when using the hono built in validator for a route setup in this general format The error occurs when using c.req.valid(). The function still works but it just gives this weird parsing error about type assignments
Argument of type 'string' is not assignable to parameter of type 'never'.ts(2345)
app.get("someroute", (c) => {...})
.post(valdator("form", (value, c) => {...}), (c) => {
const {data1, data2} = c.req.valid("form") //error shown here
})
I am working around it doing this:
app.get("someroute", (c) => {...});
.post("someroute", valdator("form", (value, c) => {...}), (c) => {
const {data1, data2} = c.req.valid("form")
})
I'm adding redundant route declarations which is not ideal
What is the expected behavior?
there should be no error
What do you see instead?
Argument of type 'string' is not assignable to parameter of type 'never'.ts(2345)
Additional information
thanks in advance! No response