From f24c309b38557e81ca70a212573db78d82dc95b4 Mon Sep 17 00:00:00 2001 From: Alex Lockhart Date: Tue, 21 Apr 2020 11:42:55 +0100 Subject: [PATCH] Update CachedQuery to add type to state member --- types/index.d.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 81ee104f52..6a03e8cad4 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -566,12 +566,23 @@ export type MutationResult = | ErrorMutationResult | SuccessMutationResult -export interface CachedQuery { +export interface CachedQueryState { + data?: T + error?: unknown | null + failureCount: number + isFetching: boolean + canFetchMore?: boolean + isStale: boolean + status: 'loading' | 'error' | 'success' + updatedAt: number +} + +export interface CachedQuery { queryKey: AnyQueryKey queryVariables: AnyVariables queryFn: (...args: any[]) => unknown config: QueryOptions - state: unknown + state: CachedQueryState setData( dataOrUpdater: unknown | ((oldData: unknown | undefined) => unknown) ): void