Jokcy8mo ago

Is there any easy way to create a Type for a trpc router

I want to publish a set of trpc api client to npm, which will be used by my customer directly. But if I use typeof MyRouter to infer the Router type, my bundler (which is tsup) will bundle db schema types into the d.ts file. If I want my customer to gain the typesafe ability I have to make my db schema info public. Is there any way to define a Router type without typeof MyRouter type infer? So that I can expose limited info to public.
1 Reply
Nick8mo ago
Sounds like you need to set up type validators on the outputs. It makes sense if you rely on inference that you’ll get everything included down to the low level