Closed as not planned
Description
Description
The select
property of the query options does not infer the type correctly.
Reproduction
Simply return a different type from the select call.
Example:
const { data: firstUser } = QAPI.useQuery(
"get",
"/api/users", // endpoint usually returns an array of users, e.g. User[]
{},
{
select: (data) => data[0], // want to return something different here, i.e. User
},
);
In this case you get an error from the compiler stating Type User is not assignable to type User[]
...
Expected result
Type inference just works.
Checklist
- I’m willing to open a PR (see CONTRIBUTING.md)