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;
withSkipToken.data;
Your minimal, reproducible example#
https://codesandbox.io/p/sandbox/tanstack-react-query-usequeries-skiptoken-issue-wdk8m5
Steps to reproduce#
- Open repro
- Hover over
withEnabled.data and withSkipToken.data to 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
@Jaaneek can you take a look here? I'm afraid I'm no expert with the
userQueriestypings 😅