tRPCttRPC
Powered by
Ahmad ShbeebA
tRPC•2y ago•
2 replies
Ahmad Shbeeb

trpc useQuery/useMutation not inferring return type of prisma query

Env: Node18 , npm
i'm using turborepo with the server as Honojs + hono-trpc adapter and the client as react vite

So i've already did the setup as said in the docs and everything is working perfectly everything returned from the trpc procedures is inferred except when i return a prisma query then the inferred type is "any" ??

Even though the procedure output is correct but the client is "any" only with prisma
i've already tried using superjson transformer still no luck
image.png
image.png
Solution
i solved it
so it was an error with the context which contains (prisma and telegram bot) not being inferred from the client so i had to type it manually now all returned prisma queries works as expected
image.png
image.png
Jump to solution
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Issue Inferring Type on Frontend with ElectroDB Query Return Statement
NicolasNNicolas / ❓-help
3y ago
Type mismatch with queryClient prop of @trpc/react-query
MadyanMMadyan / ❓-help
15mo ago
return type of a query endpoint
rustclanRrustclan / ❓-help
3y ago