T
TanStack3y ago
equal-aqua

next 13

How can I create a generic type of queries? Say I want to pass a prop through to a component such as this:
dayBookQuery: (opts: DayBookOptionProps) => SWRResponse<SupabaseManyRowResult<T>, PostgrestError>;
dayBookQuery: (opts: DayBookOptionProps) => SWRResponse<SupabaseManyRowResult<T>, PostgrestError>;
I am getting a type error on the 'count' value that's returned from the query, any idea how I would type this properly so that count isn't giving me errors or if there is a better way to generic type a query?
3 Replies
generous-apricot
generous-apricot3y ago
UseQueryResult ?
equal-aqua
equal-aquaOP3y ago
still getting this: Property  count  does not exist on type  UseQueryResult<T[]>
generous-apricot
generous-apricot3y ago
Yes. What do you expect count to be? I guess you meant to access data instead of count

Did you find this page helpful?