brrB
tRPC2y ago
1 reply
brr

Trying to get the return type of a procedure.

Using TRPC v11. I am failing to return the type. I get the error
Type alias 'ProtectedProcedureType' circularly references itself.


Any ideas?
This is my code
type ProtectedProcedureType = inferProcedureBuilderResolverOptions<
  typeof protectedProcedure
>;

export type ProtectedProcedureContext = ProtectedProcedureType["ctx"];

I need the type to be reusable in other files.

I also tried this

type ProtectedProcedure = typeof protectedProcedure 
type ProtectedProcedureOptions = Parameters<Parameters<ProtectedProcedure['query']>[0]>[0]
export type ProtectedProcedureContext = ProtectedProcedureOptions['ctx']

still when I slap on the
export
I get the circularly references itself error...
Was this page helpful?