docs(rpc): document the promise chain inference limitation - #897
Merged
yusukebe merged 2 commits intoAug 22, 2026
Merged
Conversation
A handler that returns a `.then()` chain directly infers `unknown` on the client. Inside the callback, the type of `c` depends on the handler's return type, which is what the callback is being used to infer, so TypeScript falls back to the constraint of the return type and the response type is lost. Document the limitation under "Known issues" together with the two ways around it, as suggested in honojs/hono#4765. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019bYuvGzZDDeCezDyTF1T5n
yusukebe
approved these changes
Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documents the RPC limitation reported in honojs/hono#4765, where a handler that
returns a
.then()chain directly infersunknownon the client.@yusukebe suggested
leaving the behaviour as-is and documenting the limitation, so this adds it
under "Known issues" in the RPC guide, with the reason it happens and the two
ways around it.
Each snippet was checked against
honomain:.then()chain infersunknownc.json(d)infers{ hello: string }then<TypedResponse<{ hello: string }, 200, 'json'>>infers{ hello: string }TypedResponseis used for the annotation becauseJSONRespondReturnis notexported from the package.