hono
hono copied to clipboard
c.Var types unknown
What version of Hono are you using?
4.2.7
What runtime/platform is your app running on?
CF Workers
What steps can reproduce the bug?
` const redirectHtmx: MiddlewareHandler<{ Variables: { redirectHtmx: (url: string) => Response } }> = async (c, next) => { c.set('redirectHtmx', (url: string) => new Response(null, {headers: {'HX-Location': url}})) await next() } app.use('*', redirectHtmx)
c.var.redirectHtmx('/page') is of type unkown `
What is the expected behavior?
https://hono.dev/api/context#var
What do you see instead?
is of type unkown on additional methods
Additional information
No response
I think you have to write the env generics to Hono instance.
Makes sense, but then the docs are wrong.
That's true. I'll fix it later!
Hi, @janat08 The website has been updated! Thanks!
@janat08 @sor4chi Thanks!
Closing the issue.