MonkeyStruct
MonkeyStruct2y ago

createTRPCNext type error

Hi everyone. So I started creating nextjs app with trpc + prisma set up. and when i use my AppRouter type with createTRPCNext I get "The types returned by createCaller(...) are incompatible between these types." error
Type 'CreateRouterInner<RootConfig<{ ctx: { user: User | null; prisma: PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation | undefined>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>' 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: { user: User | null; prisma: PrismaClient<...>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>; user: CreateRouter...' 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: { user: User | null; prisma: PrismaClient<...>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>; user: CreateRouter...' 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'.
Type 'CreateRouterInner<RootConfig<{ ctx: { user: User | null; prisma: PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation | undefined>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>' 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: { user: User | null; prisma: PrismaClient<...>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>; user: CreateRouter...' 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: { user: User | null; prisma: PrismaClient<...>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>; user: CreateRouter...' 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'.
this is whole error msg and I'm not sure if you guys have seen it!
4 Replies
Nick
Nick2y ago
Are all your tRPC package versions the same version? They must all match
MonkeyStruct
MonkeyStructOP2y ago
Holy crap. U were right my server-side was 10.21.0 and client side was 10.21.1 and when I updated server it works find. 💪🏻 thank you!
Nick
Nick2y ago
Second time I’ve seen it this week 😅
shu
shu2y ago
Hi, im having the same error expect my versions are all 10.20.0

Did you find this page helpful?