how to define backend context type #2674
-
There was a change in the last few versions of v10. Previously: export const t = initTRPC<{ // previously
ctx: MyTRPCContext
}>()() worked ok to define the ctx type for the router. export const t = initTRPC.create<{
ctx: MyTRPCContext
}>() but that just gives me
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
See https://trpc.io/docs/server/context for the new way of declaring context: const t = initTRPC.context<MyTRPCContext>().create() |
Beta Was this translation helpful? Give feedback.
-
How to get the modified context type after adding some middleware handlers with Trying to do: type FinalContextAfterMiddleware = inferAsyncReturnType<typeof protectedAppProcedure> But this leads to:
|
Beta Was this translation helpful? Give feedback.
See https://trpc.io/docs/server/context for the new way of declaring context: