setQueryData
updater function's parameter incorrectly typed as unknown
in expression body arrow functions
#9024
Labels
Describe the bug
When using
queryClient.setQueryData
inside an expression body arrow function (without curly braces), the updater function's data parameter is incorrectly typed asunknown
.However, when used in a block body arrow function (with curly braces), the type is correctly inferred as expected.
Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-query-wcdibka8?file=src%2Findex.tsx
Steps to reproduce
Expected behavior
The updater function's
data
parameter should be correctly typed in both cases, regardless of whether the arrow function uses an expression body or block body syntax.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
None
TanStack Query version
v5.74.3
TypeScript version
v5.8.3
Additional context
I am looking into it and once I find a solution, I'll submit a PR.
The text was updated successfully, but these errors were encountered: