Type Error when using useQueries
with results returning different types, generated from an array
#7974
Labels
useQueries
with results returning different types, generated from an array
#7974
Describe the bug
I want to use
useQueries
to fetchx
queries every time, and anothery
queries, whose count is not known at compile time.Here is a short example (playground below):
There is a type error that says:
Your minimal, reproducible example
https://tsplay.dev/mq2d2W
Steps to reproduce
use
useQueries
with a variable count of queries that have different return type than other queriesExpected behavior
Expected to be able to pass an array of queries with variable length to
useQueries
, along with other queries with different return type.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
None
TanStack Query version
5.52.1
TypeScript version
5.5.4
Additional context
Edit: I tinkered a bit more with this and it appears that the issue is with the
queryOptions
function. Here is the full error:Edit 2: If all queries return the same type of result, it works.
The text was updated successfully, but these errors were encountered: