Best practice for using router types on client-side?
I saw that in T3s
src/utils/trpc.ts
we are provided with:
Can I effectively use this at the client-side like:
const response: RouterOutputs['example']['hello']
or would that import a lot of unnecessary types at the client?
Defining the types one by one and having to name them like:
type HelloOutput = RouterOutputs['example']['hello']
is doable but annoying.
Preferably I would like to avoid this step.
Is that possible in a non-stupid way? 😄1 Reply
types don't exist at runtime so this is a non issue
i usually don't even create named types from the inference helpers, just use them directly