Complex type inference on router outputs?
What are the best practices on complex outputs from routers and typing on the FE? We are doing quite a bit of munging of data from multiple sources, so there's no real concept of an upstream "primitive" as there would be in a simple trpc + nextjs + prisma setup.
How is everyone doing typing in a scenario like this? It feels brittle to bind a UI element to the response from a router as that will intrinsically bind those two elements together, making the component non-reusable.
Is there a typing layer for trpc that sorta behaves like GQL, where you get a meta layer of types from the router responses?
1 Reply
tl;dr no
longer: https://github.com/trpc/trpc/discussions/2150
GitHub
Dynamically type the data result of a hook according to inputs ยท tr...
Hey, folks! We ran into a hiccup with trying to dynamically type the data that comes back from our endpoint. Imagine an identity endpoint that can return either a string or a number: // I recognize...