Skip to content
Discussion options

You must be logged in to vote

Hi @darcyrush

Thank you for the thread, and sorry to be late. The reason is simple: as you said, JSON.parse() returns any, so I followed it. As you said, users can use c.req.json<MyDto>() to specify the type and c.req.valid() for validation.

I can understand the merit of returning unknown, and we have to consider it for the next major release.

Plus, actually, there was a policy for me before I created Hono that made it easy about types. This isn't told, but I wasn't super familiar with TypeScript when I started creating Hono. My thought about TypeScript types was that they can be "loose": the value could be any, and this was no problem. It's a historical reason.

But anyway, we have to acc…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@darcyrush
Comment options

Answer selected by darcyrush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants