Skip to content

Commit 652567b

Browse files
authored
Update CachedQuery to add type to state member (#386)
1 parent da81b9f commit 652567b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

types/index.d.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,12 +566,23 @@ export type MutationResult<TResult> =
566566
| ErrorMutationResult<TResult>
567567
| SuccessMutationResult<TResult>
568568

569-
export interface CachedQuery {
569+
export interface CachedQueryState<T> {
570+
data?: T
571+
error?: unknown | null
572+
failureCount: number
573+
isFetching: boolean
574+
canFetchMore?: boolean
575+
isStale: boolean
576+
status: 'loading' | 'error' | 'success'
577+
updatedAt: number
578+
}
579+
580+
export interface CachedQuery<T> {
570581
queryKey: AnyQueryKey
571582
queryVariables: AnyVariables
572583
queryFn: (...args: any[]) => unknown
573584
config: QueryOptions<unknown>
574-
state: unknown
585+
state: CachedQueryState<T>
575586
setData(
576587
dataOrUpdater: unknown | ((oldData: unknown | undefined) => unknown)
577588
): void

0 commit comments

Comments
 (0)