You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When typing createQuery and createMutation with jsdoc comments, the return data type gets inferred correctly for the mutationFn, but not for queryFn. If i mistype the data in a query, i will not get a warning. For mutations, that works.
Hi @PhilippMolitor , I've tried this with @tanstack/react-query and it has the same limitation. Both share the underlying QueryObserverResult and MutationObserverResult types.
lachlancollins
changed the title
svelte-query + jsdoc type inference broken for createQuery, but not for createMutation
JSDoc return type inference broken for useQuery/createQuery, but not for useMutation/createMutation
Jul 18, 2024
Describe the bug
When typing
createQuery
andcreateMutation
with jsdoc comments, the return data type gets inferred correctly for themutationFn
, but not forqueryFn
. If i mistype the data in a query, i will not get a warning. For mutations, that works.Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-query-jsdoc?file=src%2Flib%2Ftest.js
Steps to reproduce
Have a look at the stackblitz demo, in the comments it is described how to see that type inference behaves inconsistently.
Expected behavior
queryFn
should infer from the attached jsdoc type atcreateQuery
just likecreateMutation
does. Other types ofcreate...
could be affected as well.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
svelte-query
TanStack Query version
5.49.0
TypeScript version
Additional context
No response
The text was updated successfully, but these errors were encountered: