I am having trouble with the useQueries functionality of Tanstack Query (formerly known as React Query).
This example from the documentation (using some example data: let users = [{ id: 1 }, { id: 2 }, { id: 3 }];
)
const userQueries = useQueries({
queries: users.map((user) => {
return {
queryKey: ['user', user.id],
queryFn: () => fetchUserById(user.id),
}
}),
});
renders a type error:
Argument of type '{ queries: { queryKey: (string | number)[]; queryFn: () => any; }[]; }' is not assignable to parameter of type 'readonly any[]'.
Object literal may only specify known properties, and 'queries' does not exist in type 'readonly any[]'.ts(2345)
Is the documentation wrong or what am I doing wrong?