Open
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)