-
-
Notifications
You must be signed in to change notification settings - Fork 597
Open
Labels
bugSomething isn't workingSomething isn't workingopenapi-react-queryRelevant to openapi-react-queryRelevant to openapi-react-query
Description
openapi-react-query version
0.3.1
Description
useInfiniteQuery does not infer the type from the select option the same way useQuery does. See #2105.
Reproduction
$api.useInfiniteQuery(
'post',
'/api/v1/events',
{},
{
select: (data) => data.pages.flatMap((page) => page.data),
}
)Produces this error:
Type '(data: InfiniteData<{ data: { id: string }[]; }, unknown>) => { ...; }[]' is not assignable to type '(data: InfiniteData<{ data: { id: string; }[]; }, unknown>) => InfiniteData<...>'.
Expected result
The select type should infer the type for data exactly as useQuery would.
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)
zapier-interviews, DevSnap, erwanlpfr and jesus-lopez-complexity
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingopenapi-react-queryRelevant to openapi-react-queryRelevant to openapi-react-query