sh03
sh039mo ago

Type 'QueryClient' is missing the following properties from type 'QueryClient': queryCache, mutation

I'm getting this error:
Type 'QueryClient' is missing the following properties from type 'QueryClient': queryCache, mutationCache, logger, defaultOptions, and 4 more.ts(2740) context.d.ts(48, 5): The expected type comes from property 'queryClient' which is declared here on type 'IntrinsicAttributes & TRPCProviderProps<CreateRouterInner<RootConfig<{ ctx: object; meta: object; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>, { ...; }>, unknown>'
on line:
<api.Provider client={trpcClient} queryClient={queryClient}>
<api.Provider client={trpcClient} queryClient={queryClient}>
^ (copy pasted from https://trpc.io/docs/client/react/setup) These are my relevant package versions:
"@tanstack/react-query": "^5.24.1",
"@trpc/client": "^10.45.1",
"@trpc/react-query": "^10.45.1",
"@trpc/server": "^10.45.1",
"@tanstack/react-query": "^5.24.1",
"@trpc/client": "^10.45.1",
"@trpc/react-query": "^10.45.1",
"@trpc/server": "^10.45.1",
what am I doing wrong?
Solution:
Just run the npm install again and you should be good or downgrade @tanstack/react-query to @tanstack/query@4
Jump to solution
7 Replies
BeBoRE
BeBoRE9mo ago
If you did npm install @trpc/server@next @trpc/client@next @trpc/react-query@next @trpc/next@next @tanstack/react-query@latest then you shouldn't get those package versions tRPC v10 doesn't work with react-query v5 I believe
Solution
BeBoRE
BeBoRE9mo ago
Just run the npm install again and you should be good or downgrade @tanstack/react-query to @tanstack/query@4
sh03
sh03OP9mo ago
10.45.1 in the source code has a dependency of ^5.0.0 on tanstack react query though: https://github.com/trpc/trpc/blob/cdf215127a172e497468dec04acb8ea12e840e84/packages/react-query/package.json#L61 What am I missing? @BeBoRE
BeBoRE
BeBoRE9mo ago
npm
@trpc/server
The tRPC server library. Latest version: 10.45.1, last published: 25 days ago. Start using @trpc/server in your project by running npm i @trpc/server. There are 295 other projects in the npm registry using @trpc/server.
BeBoRE
BeBoRE9mo ago
You are probably looking at the next branch Pretty sure that on the next branch the version gets transformed
julius
julius9mo ago
the default branch (next) is for v11 v10 requires tanstack query v4
sh03
sh03OP9mo ago
Gotcha, thanks very much 👍