T
TanStack10mo ago
other-emerald

How can I specify accepting a queryOptions as a type?

I want to make a SelectAsync component that accepts this prop:
/**
* A react-query queryOptions to be passed to {@link useQuery},
* with data being returned as an array of `items`.
*
* The query is made immediately upon mount, not lazily upon dropdown open.
*/
getItemsQueryOptions: UseQueryOptions<{ items: Item[] }>;
/**
* A react-query queryOptions to be passed to {@link useQuery},
* with data being returned as an array of `items`.
*
* The query is made immediately upon mount, not lazily upon dropdown open.
*/
getItemsQueryOptions: UseQueryOptions<{ items: Item[] }>;
I'm not sure that UseQueryOptions is the right type to specify though, since my constructed queryOptions calls aren't matching up
3 Replies
other-emerald
other-emeraldOP10mo ago
I'm also using select a bit in these queryOptions, so that might be part of the issue?

Did you find this page helpful?