trpc / trpc/trpc

bug: Type inference not working for streams

Open
#6,407 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

📚 documentation / examples blocked bug in documentation/example
Dominant language
TypeScript
Stars
40.6k
Forks
1.7k
Avg merge
1d 22h
Merged PRs (30d)
22

Description

Provide environment information

https://trpc.io/?try=minimal#try-it-out

Describe the bug
Image

https://trpc.io/?try=minimal#try-it-out

Even in the minimal example, type inference is not working for output of async generators.

In the documentation for HTTP Batch Stream Link, it seems like type inference for async generators should still work
Image

Link to reproduction

https://trpc.io/?try=minimal#try-it-out

To reproduce

open up https://trpc.io/?try=minimal#try-it-out

hover over the type on the output of examples.iterable

notice it is any type

Additional information

No response

👨‍👧‍👦 Contributing
  • 🙋‍♂️ Yes, I'd be down to file a PR fixing this bug!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproduction at https://trpc.io/?try=minimal#try-it-out and inspect the output type of examples.iterable, which currently appears as any. Compare this behavior with the HTTP Batch Stream Link documentation and async-generator example; done means the stream output has the expected inferred type rather than any.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.