tRPCttRPC
Powered by
TimT
tRPC•3y ago
Tim

Distribute typesafe tRPC Client in an NPM library

Hi ! super fan of trpc over here.

We are building a javascript sdk for our API that is essentially a pacakged version of the trpc client.

However when compiling the code, the "materialized" type is a generic client/router and not the inferred typesafe version.

e.g

opts: _trpc_react.CreateTRPCClientOptions<_trpc_server_dist_declarations_src_router.Router<AppContextCore, unknown, any, any, any, any, _trpc_server.DefaultErrorShape>>) => _trpc_react.TRPCClient<_trpc_server_dist_declarations_src_router.Router<AppContextCore, unknown, any, any, any, any, _trpc_server.DefaultErrorShape>>;
opts: _trpc_react.CreateTRPCClientOptions<_trpc_server_dist_declarations_src_router.Router<AppContextCore, unknown, any, any, any, any, _trpc_server.DefaultErrorShape>>) => _trpc_react.TRPCClient<_trpc_server_dist_declarations_src_router.Router<AppContextCore, unknown, any, any, any, any, _trpc_server.DefaultErrorShape>>;


Any thoughts ? tRPC seems like a perfect fit for this use case.

Thanks!
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Using both tRPC React client AND tRPC React Query client
anton.johanssonAanton.johansson / ❓-help
3y ago
tRPC Client webpack error
MugetsuMMugetsu / ❓-help
4y ago
Using TRPC Server Caller in client side.
MonkeyStructMMonkeyStruct / ❓-help
2y ago