fix(openapi): preserve event iterator return type in JsonifiedClient - #1798
Merged
Conversation
Contributor
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/client
@orpc/contract
@orpc/experimental-durable-iterator
@orpc/hey-api
@orpc/interop
@orpc/json-schema
@orpc/nest
@orpc/openapi
@orpc/openapi-client
@orpc/otel
@orpc/experimental-pino
@orpc/experimental-publisher
@orpc/experimental-publisher-durable-object
@orpc/experimental-ratelimit
@orpc/react
@orpc/react-query
@orpc/experimental-react-swr
@orpc/server
@orpc/shared
@orpc/solid-query
@orpc/standard-server
@orpc/standard-server-aws-lambda
@orpc/standard-server-fastify
@orpc/standard-server-fetch
@orpc/standard-server-node
@orpc/standard-server-peer
@orpc/svelte-query
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/vue-colada
@orpc/vue-query
@orpc/zod
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.

v1 port of #1797.
JsonifiedClientwas losing an event iterator's return type: a contract witheventIterator(z.number(), z.number())produced an iterator withTReturn = anyinstead of the jsonified return type.AsyncIteratorClass'sreturn(value?: any)signature made TypeScript inferTReturnasanywhen matched againstAsyncIteratorObject<infer U, infer V>, since inference works off actual method signatures rather than theimplementsclause.Fixes #1796
Fixes
JsonifiedValuenow matchesAsyncIteratorClassdirectly (its own case, ahead of the genericAsyncIteratorObjectbranch), so the return type inference is no longer poisoned.AsyncGeneratorand plainAsyncIteratorObjectvalues now keep their own shape instead of being widened, matching the updated fix(openapi): preserve event iterator return type in JsonifiedClient #1797.Testing
JsonifiedValueoverAsyncIteratorClass/AsyncGenerator/AsyncIteratorObjectand the end-to-end reproduction throughJsonifiedClient(using v1'seventIterator+ContractRouterClient); three assertions fail before the fix and pass after.tsc -b,tsc --noEmit, and eslint are clean.