Angular: no type narrowing on infinite query status
Open
@arnoud-dv is already working on this.
Since Sep 24, 2025.
package: angular-query-experimental
types
- Dominant language
- TypeScript
- Stars
- 50.3k
- Forks
- 4.2k
- Avg merge
- 18h 25m
- Merged PRs (30d)
- 200
Description
Describe the bug
injectQuery and injectMutation support type narrowing via the is* status signals.
This was not implemented for injectInfiniteQuery
Your minimal, reproducible example
Steps to reproduce
On linked TS playground:
const infiniteQuery = injectInfiniteQuery(() => ({
queryKey: ["projects"],
queryFn: ({ pageParam }) => {
return Promise.resolve(5);
},
initialPageParam: 2,
getPreviousPageParam: (firstPage) => 1,
getNextPageParam: (lastPage) => 3,
}));
if (infiniteQuery.isSuccess()) {
// ❌ after checking isSuccess data signal still possibly undefined
const data = infiniteQuery.data();
}
Expected behavior
Type narrowing should work for infinite queries on Angular too
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
N/A
Tanstack Query adapter
angular-query
TanStack Query version
v5.72.3
TypeScript version
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.