T
TanStack13mo ago
extended-salmon

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
extended-salmon
extended-salmonOP13mo 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?