advanced
advanced5mo ago

client unable to infer output types

I'm using v11 of trpc in tandem with drizzle on my backend. The client is a react native app. I've spent several hours trying to figure out why my outputs are inferred as Any. when I check the type on the backend I get the correct type so it's only happening on the client. for example product.list is a drizzle query that return an array of product but this is what I get.
type LIST /* LIST is Any */ = RouterOutputs["product"]["list"];

inferRouterOutputs<AppRouter>
type RouterOutputs = {
product: GetInferenceHelpers<"output", {
ctx: any;
meta: object;
errorShape: DefaultErrorShape;
transformer: false;
}, {
list: QueryProcedure<{
input: {
cursor: number;
pageSize: number;
};
output: any;
}>;
}>;
user: GetInferenceHelpers<...>;
}
type LIST /* LIST is Any */ = RouterOutputs["product"]["list"];

inferRouterOutputs<AppRouter>
type RouterOutputs = {
product: GetInferenceHelpers<"output", {
ctx: any;
meta: object;
errorShape: DefaultErrorShape;
transformer: false;
}, {
list: QueryProcedure<{
input: {
cursor: number;
pageSize: number;
};
output: any;
}>;
}>;
user: GetInferenceHelpers<...>;
}
if I create a simple proc that return an array or a string it is inferred correctly. for more detail about the stack I'm on vscode ts 5.4.5 trpc/client 11.0.0-rc.377 trpc/react-query 11.0.0-rc.377 drizzle-orm 0.30.10
2 Replies
BeBoRE
BeBoRE5mo ago
FAQ / Troubleshooting | tRPC
Collection of frequently asked questions with ideas on how to troubleshoot & resolve them.
advanced
advanced5mo ago
I've found the issue I had import type { Context } from "@context"; in my import instead of ./Context not sure why ts didn't complain earlier. spent 5 hours total because of a single character.