Skip to main content

One post tagged with "Elysia"

View All Tags

Typed Clients From Your Backend

· 11 min read
Maciej Pyrc
Creator of Hyper Fetch | @BetterTyped
Feature

Typed Clients From Your Backend

tRPC, oRPC, Hono and Elysia types, straight into createSdk.

api.ts×
createSdk<typeof client, TrpcSchema<AppRouter>>(client, {
camelCaseToKebabCase: false,
});
createSdk<typeof client, OrpcSchema<typeof router>>(client, {
camelCaseToKebabCase: false,
});
createSdk<typeof client, HonoSchema<typeof app>>(client);
createSdk<typeof client, ElysiaSchema<typeof app>>(client);

Your backend already knows the shape of every route: its input, its output and its errors. Writing that shape a second time on the frontend is busywork, and it drifts the moment someone renames a field. HyperFetch 10 adds four packages that read the types of a tRPC router, an oRPC router, a Hono app or an Elysia app, and hand them to createSdk.