T
TanStack3y ago
harsh-harlequin

useQueries should enforce types on the `queries` param

I just spent hours questioning my sanity on this error:
const selectedThingsQueries = useQueries({
queries: selectedThings.map((thingId) => {
querykey: ['thing', thingId],
queryFn: () => fetchThing({ thingId }),
}),
})
const selectedThingsQueries = useQueries({
queries: selectedThings.map((thingId) => {
querykey: ['thing', thingId],
queryFn: () => fetchThing({ thingId }),
}),
})
until I realized that I had a lowercase querykey instead of queryKey. I made a small reproduction of this here: https://codesandbox.io/s/peaceful-aj-kvy7mm?file=/src/App.tsx no typescript errors. on the answer you get the correct number of items, but all of them return copies of the last item resolved. is it possible to type check this? how? I'd love to contribute here.
1 Reply

Did you find this page helpful?