Aezral
Aezral2y ago

Having trouble to import my AppRouter in my react client

Environment: Node v18.15.0 I created my TRPC router in my express app and exported it how -documentation says, but when i try to import it from my react client, i get this error: Type 'CreateRouterInner<RootConfig<{ ctx: { operator: string | null; session: { school: { name: string; id: string; GMTOffset: number; }; permission: "administrator" | "checker" | "student"; } | null; }; meta: object; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>, { ...; }>' does not satisfy the constraint 'Router<AnyRouterDef<AnyRootConfig, any>>'. The types returned by 'createCaller(...)' are incompatible between these types. Type '{ query: inferHandlerFn<{}>; mutation: inferHandlerFn<{}>; subscription: inferHandlerFn<{}>; } & DecoratedProcedureRecord<{ auth: CreateRouterInner<RootConfig<{ ctx: { operator: string | null; session: { ...; } | null; }; meta: object; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>, { ...; }>...' is not assignable to type '{ query: inferHandlerFn<any>; mutation: inferHandlerFn<any>; subscription: inferHandlerFn<any>; } & DecoratedProcedureRecord<any>'. Type '{ query: inferHandlerFn<{}>; mutation: inferHandlerFn<{}>; subscription: inferHandlerFn<{}>; } & DecoratedProcedureRecord<{ auth: CreateRouterInner<RootConfig<{ ctx: { operator: string | null; session: { ...; } | null; }; meta: object; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>, { ...; }>...' is not assignable to type '{ query: inferHandlerFn<any>; mutation: inferHandlerFn<any>; subscription: inferHandlerFn<any>; }'. Types of property 'query' are incompatible. Type 'inferHandlerFn<{}>' is not assignable to type 'inferHandlerFn<any>'. Types of parameters 'path' and 'path' are incompatible. Type 'TPath' is not assignable to type 'never'. Type 'string' is not assignable to type 'never'.
Solution:
forget it it was the @trpc/server version 💀
Jump to solution
1 Reply
Solution
Aezral
Aezral2y ago
forget it it was the @trpc/server version 💀