Can't get type inference from createTRPCNext instance
Hi everyone,
I have separate FE and BE using tRPC to communicate, in a monorepo environment. The FE app is a simple Next.js app, the BE is tRPC with Express. I'm using Bun as the runtime.
I'm exporting
AppRouter
from the BE as per the instructions, and importing the type in the FE and passing it as a type argument to createTRPCNext
. When inspecting createTRPCNext
in the FE, I can see the type has resolved and the procedures are in there.
However, when I create the FE tRPC instance (const trpc = createTRPCNext<AppRouter>({...})
), the trpc
variable has a complex type attached to it (posted below), but nothing is really typed. when I do trpc.example
(one of my procedures), it's any
. When I try to get the tRPC HOC (withTRPC
), that is any
also. Why arent the types getting infered properly in the FE? That is what I'm trying to solve at the moment.
The type:
Thanks!0 Replies