tRPCttRPC
Powered by
SebasPtschS
tRPC•3y ago•
10 replies
SebasPtsch

Canary useUtils and createTRPCQueryUtils type not callable

Trying to access utils object in my application after using
useUtils
useUtils
or
createTRPCQueryUtils
createTRPCQueryUtils
and getting the following type error:
This expression is not callable.
  Not all constituents of type '(DecorateRouter & { [x: string]: (DecorateRouter & ...) | DecorateProcedure<_trpc_server_dist_core_procedure.QueryProcedure<{ input: void; output: { isAuthenticated: boolean; isAdmin: boolean; }; }>, _trpc_server_dist_core_procedure.QueryProcedure<{ input: void; output: { ...; }; }>>; }) | DecorateProcedure<...> | (...' are callable.
    Type 'DecorateRouter & { [x: string]: (DecorateRouter & ...) | DecorateProcedure<_trpc_server_dist_core_procedure.QueryProcedure<{ input: void; output: { isAuthenticated: boolean; isAdmin: boolean; }; }>, _trpc_server_dist_core_procedure.QueryProcedure<{ input: void; output: { ...; }; }>>; }' has no call signatures.
This expression is not callable.
  Not all constituents of type '(DecorateRouter & { [x: string]: (DecorateRouter & ...) | DecorateProcedure<_trpc_server_dist_core_procedure.QueryProcedure<{ input: void; output: { isAuthenticated: boolean; isAdmin: boolean; }; }>, _trpc_server_dist_core_procedure.QueryProcedure<{ input: void; output: { ...; }; }>>; }) | DecorateProcedure<...> | (...' are callable.
    Type 'DecorateRouter & { [x: string]: (DecorateRouter & ...) | DecorateProcedure<_trpc_server_dist_core_procedure.QueryProcedure<{ input: void; output: { isAuthenticated: boolean; isAdmin: boolean; }; }>, _trpc_server_dist_core_procedure.QueryProcedure<{ input: void; output: { ...; }; }>>; }' has no call signatures.
Solution
Figured this out, was to do with me exporting the server types and importing them on the client. Added a path override similar to what is done in the trpc project to just grab the AppRouter type from the typescript files rather than the generated declaration.
Jump to solution
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Error using createTRPCQueryUtils
RuleRRule / ❓-help
2y ago
useUtils vs useQueryClient
RealityShiftRRealityShift / ❓-help
3y ago
Where did useUtils go?
JonathanJJonathan / ❓-help
12mo ago
Getting type error in v11 when trying to instantiate createTRPCQueryUtils
charliephanCcharliephan / ❓-help
3y ago