-
-
Couldn't load subscription status.
- Fork 3.5k
Closed
Labels
bugSomething isn't workingSomething isn't workinghas workaroundhelp wantedExtra attention is neededExtra attention is neededtypes
Description
Describe the bug
When using useQueries with skipToken, queryResult.data is inferred as unknown instead of the actual return type of the queryFn.
const [withEnabled] = useQueries({
queries: [{ queryKey: ["withEnabled"], queryFn: () => 1, enabled: true }],
});
const [withSkipToken] = useQueries({
queries: [
{ queryKey: ["withSkipToken"], queryFn: true ? () => 1 : skipToken },
],
});
withEnabled.data;
// ^? number | undefined
withSkipToken.data;
// ^? unknownYour minimal, reproducible example
https://codesandbox.io/p/sandbox/tanstack-react-query-usequeries-skiptoken-issue-wdk8m5
Steps to reproduce
- Open repro
- Hover over
withEnabled.dataandwithSkipToken.datato see the types
Expected behavior
I expected withSkipToken.data to be inferred as number | undefined instead of unknown.
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
@tanstack/react-query v5.25.0
Tanstack Query adapter
react-query
TanStack Query version
v5.25.0
TypeScript version
v5.3.3
Additional context
No response
emrerdem1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghas workaroundhelp wantedExtra attention is neededExtra attention is neededtypes