advancedA
tRPC2y ago
2 replies
advanced

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<...>;
}

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
Was this page helpful?