-
-
Notifications
You must be signed in to change notification settings - Fork 635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPC infers "never" if type is "any | undefined" #3761
Comments
This is because JSON does not accept https://github.com/honojs/hono/blob/main/src/utils/types.ts#L27 The following will cure the problem, but it is not in accordance with the specification. - export type JSONPrimitive = string | boolean | number | null
+ export type JSONPrimitive = string | boolean | number | undefined | null |
Hi @tartuke This is not a bug. Because, as @EdamAme-x said, parsing an empty string in the client will result in an error, so in that case, the expected type is const res = await route.request('/even')
await res.json() // Error! |
I think |
nvm @yusukebe i made a mistake. was having the same issue and my train of thought went in a wrong direction. either way, i think tightening the types should solve this |
This issue has been marked as stale due to inactivity. |
Closing this issue due to inactivity. |
What version of Hono are you using?
4.6.2
What runtime/platform is your app running on? (with version if possible)
bun
What steps can reproduce the bug?
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: