T
tRPC

❓-help

tRPC is butchering object types in return types

BBert11/25/2023
So if I have a mutation that returns this type
{ name?: string }
{ name?: string }
the type that tRPC infers for the mutation is
type R = ReturnType<typeof trpcClient.mut.mutate>
R = Promise<Record<"name", string | undefined>>
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?
Nnlucas11/25/2023
Hm this might be a recent thing, there was some work done detecting record types. Could you provide a minimal repro and open a GitHub issue?
Wwleistra11/25/2023
@Bert make sure you are on version 10.44.0 or higher.
BBert11/25/2023
"@trpc/client": "^10.43.6", "@trpc/server": "^10.43.6", Yeah that fixed it. Thanks @wleistra (and @Nick Lucas for the effort)

Looking for more? Join the community!

Recommended Posts
Why my Authorization does not update ?i have this in `_app.tsx` ```export default function App({ Component, pageProps }: AppProps) { retTypeError: queryClient.getMutationDefaults is not a function (it is undefined)Hi! There's not much code to show here, as I'm really not sure where the error actually occurs. InuseQuery never returning or hitting APII have something off in my configuration, i copied most of the files from the `❯ npm create t3-app@lType 'QueryClient' is missing the following properties from type 'QueryClient': queryCache, mutationI am trying to setup a new project and doing my first client side query and getting this error: ```trpc mutation call stuckI have an issue with a simple mutation procedure: `getPublicUser: publicProcedure .input(z.objeCreate client based on OpenAPIHi! I am running a golang server with an openapi spec and would love to use trpc client in my fronteTRPC with react query, getting error twice?When i am try to show TRPC error in the client side with react-query, i am getting error twice from Error building create-t3-app: Page couldn't be rendered statically because it used `cookies`I get the following error when building create-t3-app: ``` TRPCClientError: Dynamic server usage: PaCompressing parts of query/mutation inputHi, I'm using trpc with the proxyclient for typesafety but recently hit an obstacle where some strin`useSuspenseQuery` still runs a fetch on SSR even when setting `ssr: false` in the api configBeside double-fetching, this causes issues during rendering if you have auth on your routes as the SUnsubscription callback triggering immediatelyHey! I am currently using Bun that's queried via a Vue application. For some reason the unsubscribeMultiple optimistic updates and old data from refetchesHi all, I'm new to tRPC and React Query and I'm just trying to get my head around what exactly I'm d