How can I get the returned type from select
hey folks, I have this parent component which call a useQuery
I wanted to type the props in the BucketTable component, how can I do that (notice that there is a select which add a property in the useQuery data
export const BucketTable = ({ bucket }: { bucket: ??? }) => {
2 Replies
flat-fuchsia•2mo ago
Maybe you can make something like this :
type TransformedBucket = NonNullable<ReturnType<typeof useBuckets>['data']>['items'][0];
And then export const BucketTable = ({ bucket }: { bucket: TransformedBucket })
stormy-goldOP•2mo ago
yes I could but I wanted to know if there were a cleaner solution since the query option api because we can maybe get the type of the cached data by providing the query key