Open cesaryuan opened 5 days ago
Hi @cesaryuan
This is like a bug, but it is a known issue ( sorry for not writing it explicitly). I also think this should be Record<string, string | undefined>
. But the change will be breaking change. So, it will be introduced in the next major or minor versions with the announcement. I've left this issue as an enhancement and will consider it. Thank you!
Or, you can make noUncheckedIndexedAccess
true in tsconfig.json.
By enable this, to access indexable object such as Record, Array have to be checked.
What version of Hono are you using?
4.6.2
What runtime/platform is your app running on?
Not matter
What steps can reproduce the bug?
I think the return type of
c.req.query()
should beRecord<string, string | undefined>
instead ofRecord<string, string>
The latter will cause the following code to compile without errors, but to actually run with errors:
What is the expected behavior?
The return type of
c.req.query()
should beRecord<string, string | undefined>
What do you see instead?
Record<string, string>
Additional information
No response