BertB
tRPC3y ago
5 replies
Bert

tRPC is butchering object types in return types

So if I have a mutation that returns this type
{ name?: string }

the type that tRPC infers for the mutation is
type R = ReturnType<typeof trpcClient.mut.mutate>
R = Promise<Record<"name", string | undefined>>


This is not the same, with exactOptionalPropertyTypes.

Anyone familiar with this who can provide some info about it?
Was this page helpful?