correct type of this `Context`
from here https://hono.dev/docs/middleware/builtin/timeout#usage
I tried
but it's not right: "Property 'headers' does not exist on type 'HonoRequest<any, unknown>'"

13 Replies
if you're just using the vanilla
Env
from hono, this should be fine:
personally I just gave up and used a bunch of
// @ts-ignore
s
although that code has since been deleted, because I fully migrated away from express@ts-ignore
should be a tool of last resort
Hono typing can be finicky, but if TS is telling you not to do something, there’s usually a good reason
Some code debt is always part of rapid early-stage development, but compromising on typing is a recipe for mid/long-term pain and app instability
I’ve worked for companies that lost customers because they cut TS corners early on and wound up with unreliable datatrust me, I am a ts wiz
embedding hono as middleware in an existing expressjs app and trying to pass down the remoteAddress from express down to hono was a temporary solution, so I didn't care about the type
respectfully, i'm going to trust my own understanding of typescript, and my professional experience
TL;DR it was a last resort
you may have been comfortable hiding code from TS, but i am not, *and i would strongly recommend against using
@ts-ignore
unless there is truly no other option, and even then only in a limited scopeI won't be spending more than 30 minutes trying to make typescript happy when working on a legacy codebase that I was going to rewrite in less than a week
it was a horrible experience for me as well



I got actual PTSD from that codebase, hacking it to add hono and eventually purge express was so nice

I am happy with my warcrimes
since they are now deleted