Skip to content

Commit

Permalink
fix: pass generics to setQueryData and getQueryData to infer the …
Browse files Browse the repository at this point in the history
…type (#478)

* feat types: pass a paramter to `setQueryData` to infer the type

without this, one would have to cast the type  returned.

* implement the same for `setQueryData`

* remove unnecessary import
  • Loading branch information
ryands17 authored May 12, 2020
1 parent eae537d commit f8bdce9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,10 @@ export interface QueryCache {
config?: PrefetchQueryOptions<TResult>
}): Promise<TResult>

getQueryData(key: AnyQueryKey | string): unknown | undefined
setQueryData(
getQueryData<T = unknown>(key: AnyQueryKey | string): T | undefined
setQueryData<T = unknown>(
key: AnyQueryKey | string,
dataOrUpdater: unknown | ((oldData: unknown | undefined) => unknown)
dataOrUpdater: T | ((oldData: T | undefined) => T)
): void
refetchQueries<TResult>(
queryKeyOrPredicateFn:
Expand Down

0 comments on commit f8bdce9

Please sign in to comment.