tRPCttRPC
Powered by
advancedA
tRPC•2y 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<...>;
}
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
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

How to infer query types on client?
MadMaxMMadMax / ❓-help
3y ago
How to infer types from input?
PieterPPieter / ❓-help
3y ago
How to organise output types?
sh03Ssh03 / ❓-help
4y ago