[vue-query] getQueryData/setQueryData
fail to infer query data type from queryOptions.queryFn
#6566
Labels
getQueryData/setQueryData
fail to infer query data type from queryOptions.queryFn
#6566
Describe the bug
When using
queryOptions
bothqueryClient.getQueryData
andqueryClient.setQueryData
fail to infer query data type and fallback tounknown
.Your minimal, reproducible example
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgVwM4FMCKz1QJ4DCANsOgHYwA0cAjjvgPJgzARmpwC+cAZlBCDgAiAAIwAhuwkBjANYB6AG44AtHVx4hAbgBQO6W1TwIzVuzgBeOAAoAlJYB8teniYtD1hDrjONAaXQ8AC44AG0hAAt0IiIIIQBdOHEOAylKb198ADEyELtHRAyfKHQYZCgyOAAFfhBgDAA6EtQIIkV0awByKJiITttdH050zgG9VKNMwhJyeCs0LBdiUgo7XQn4ABNxCUsp5dmGgHNS7A0AER3xaxN3djsG9XwAvDGfd7h5eQA9AH49J7TFYwBoYGBnfCXCQ3UweWyPFwvajWMAlRSsND2CxOLzFUrlSqo9DoiBoQYfClfP46UZaIA
Steps to reproduce
getQueryData
and updater callback insetQueryData
Expected behavior
Query data type should be inferred properly from
queryOptions.queryFn
.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
vue
v3.3.11Tanstack Query adapter
vue-query
TanStack Query version
v5.14.4
TypeScript version
v5.3.3
Additional context
Types are inferred properly in
@tanstack/react-query
: TS playground.I thought it's quite bizzare it doesn't work properly in vue-query knowing that it's covered by tests here.
query/packages/vue-query/src/__tests__/queryOptions.types.test.ts
Lines 88 to 101 in 4c9fde9
But these tests are using
QueryClient
from@tanstack/query-core
. After changing it to vue-specificQueryClient
type tests start to fail. I'm not sure if that's an oversight or done on purpose.The text was updated successfully, but these errors were encountered: