advanced
advanced
TtRPC
Created by advanced on 5/28/2024 in #❓-help
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
3 replies