Closed DiederikvandenB closed 3 years ago
yes, we recently added type inference for the query key on the queryFunction. before that, it was always string | Array<unknown>
.
I think you are right with passing the generic through - can you maybe PR that?
Opened PR #2100, I think it's best if we close this issue and continue any necessary discussions there.
Describe the bug It seems recently some types changed in the package. Now, the following code is not validly typed anymore:
Where
myQueryFunction
has the following type:QueryFunction<Response, QueryKey>
andtype QueryKey = ['my-query', { filter: string }];
This works though:
Expected behavior The generic types for
fetchQuery
,prefetchQuery
,fetchInfiniteQuery
, andprefetchInfiniteQuery
should probably be updated to include the TQueryKey:However, I don't know the React-Query codebase well enough to immediately start a PR.
Desktop (please complete the following information):
Additional context Full error: