Spoonman
Spoonman4w ago

Inconsistent types for mutation return type

I have a signIn mutation that returns:
{
accessToken: string;
refreshToken: string;
}
{
accessToken: string;
refreshToken: string;
}
1. When I pull the types from the AppRouter in the server (separate API with Express.js), the proper type is inferred. 2. When I pull the types of the mutation from the AppRouter, but this time from my client, the wrong type is inferred (I get never instead of string for both keys) 3. When I pull the types via Awaited<ReturnType<typeof trpc.signIn.mutate>> or by directly invoking the function, the type turns to {} See screenshots for some more details. These are the packages I have installed:
"@tanstack/react-query": "^5.61.0",
"@trpc/client": "^11.0.0-rc.643",
"@trpc/react-query": "^11.0.0-rc.643",
"@trpc/server": "^11.0.0-rc.643",
"@tanstack/react-query": "^5.61.0",
"@trpc/client": "^11.0.0-rc.643",
"@trpc/react-query": "^11.0.0-rc.643",
"@trpc/server": "^11.0.0-rc.643",
Why are my mutation output types getting lost? Thanks!
No description
No description
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?