Re:TRPC: End-to-end typesafe APIs made easy
by chrisarnesen on Friday May 06, 2022 @12:10PM
(#31286848)
TRPC is designed for systems where the front and back ends are both TypeScript. In that case it's simpler to have them share code than to go through an intermediary type system such as GraphQL.
Re:TRPC: End-to-end typesafe APIs made easy
by goodoldneon on Friday May 06, 2022 @12:08PM
(#31286822)
If you're using OpenAPI, you could use this to generate TypeScript interfaces:
https://github.com/bcherny/json-schema-to-typescript
It works really well
Re:TRPC: End-to-end typesafe APIs made easy
by sachinraja on Friday May 06, 2022 @06:07PM
(#31290066)
I don't believe there's anything really preventing the use of server-side events. The Websocket implementation is via an adapter and special client so I think the same could be done for SSE (probably achievable in an external package too).
The type exchange seems to rely on shared code between the frontend and the backend to exchange types, rather than using schemas like other systems.
Not implementing server-side events seems like a shame because they're a very capable mechanism for subscriptions without resorting to websockets.