Hono not inferring output correctly with RPC
Im having an issue related to the output of hono RPC.
I have this route to check if an organization exists by slug.
And in my AppType the Input is being inferred properly but the output is just an empty object:
What am i doing wrong?
7 Replies
hi @dpeter! it looks like the issue stems from your use of
c.body
it looks like that method's typing isn't generic, and it doesn't return a TypedResponse
It worked, thanks!
switching to
c.json
?yes
word. no problem!
just for reference, discord supports syntax highlighting in code blocks
just add the language (e.g.,
typescript
) immediately after the opening backticks (as you would normally w markdown code blocks)
i'm a bit surprised that the response type gets totally obliterated like that. perhaps the intent is that c.body
is used only in specific contexts (e.g., returning blobs), but i've seen nothing to that effect in the docs
i've actually used c.body
the same way you did. i just wasn't using the client, so i didn't run into this issue
ah, my bad. they sort of do
https://hono.dev/docs/guides/rpc#rpcThanks for the info. I missed that when i was reading the docs 😅
happy to help!
imo the wording is a bit unclear, and it's not mentioned in the
Context
spec at all