Describe the bug
I'm trying to use a QueryOptions object created with the new queryOptions() helper in a useQueries() call.
This doesn't typecheck as long as the options object contains a select-fn where the return type doesn't equal the return type of the queryFn.
It works fine when the same options object is used in a useQuery(). Same story with useSuspenseQueries() and useSuspenseQuery()
Your minimal, reproducible example
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgRwK4FMoE8DyYbAQB2AzgDRyonoCKG2FVt9w6JcAvnAGZQQhwARAAEYAQ1LiAxgGsA9FHRipMALRpMWQQChtU4iXgbsAaXRY4AXjgAKAJRWAfHADagmecEBdPQaP0sADEiK1sHS2cABT4QYGoAOkUSCAAbADd0GwBGO19JFACAZXQU9BVoUJsAEzFxAC44IlQQACNMcOca8ThnLN19fIh8QlJQ41xhgxsEbTgCzTMsBvHF+zJZ+exg5YDg9bnqUpUdzWKjmGh1jjsAbn6-Taws0KY6TRshggNb+-zxgCYXtQ3lBWCRppswQ0XJ8RiQvJwfkA
Steps to reproduce
- Hover over the error reported in the
useQueries call in query2
- Observe that it is expecting
select to return the same type as queryFn
Expected behavior
I would expect that the useQueries call would type-check the same way as the useQuery call
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
Any platform
Tanstack Query adapter
react-query
TanStack Query version
5.8.7
TypeScript version
5.3.2
Additional context
No response
Describe the bug
I'm trying to use a
QueryOptionsobject created with the newqueryOptions()helper in auseQueries()call.This doesn't typecheck as long as the options object contains a
select-fn where the return type doesn't equal the return type of thequeryFn.It works fine when the same options object is used in a
useQuery(). Same story withuseSuspenseQueries()anduseSuspenseQuery()Your minimal, reproducible example
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgRwK4FMoE8DyYbAQB2AzgDRyonoCKG2FVt9w6JcAvnAGZQQhwARAAEYAQ1LiAxgGsA9FHRipMALRpMWQQChtU4iXgbsAaXRY4AXjgAKAJRWAfHADagmecEBdPQaP0sADEiK1sHS2cABT4QYGoAOkUSCAAbADd0GwBGO19JFACAZXQU9BVoUJsAEzFxAC44IlQQACNMcOca8ThnLN19fIh8QlJQ41xhgxsEbTgCzTMsBvHF+zJZ+exg5YDg9bnqUpUdzWKjmGh1jjsAbn6-Taws0KY6TRshggNb+-zxgCYXtQ3lBWCRppswQ0XJ8RiQvJwfkA
Steps to reproduce
useQueriescall inquery2selectto return the same type asqueryFnExpected behavior
I would expect that the
useQueriescall would type-check the same way as theuseQuerycallHow often does this bug happen?
None
Screenshots or Videos
No response
Platform
Any platform
Tanstack Query adapter
react-query
TanStack Query version
5.8.7
TypeScript version
5.3.2
Additional context
No response