import { Ref, WatchSource } from 'vue' import SWRVCache from './cache' import LocalStorageCache from './cache/adapters/localStorage' export type fetcherFn = (...args: any) => Data | Promise export interface IConfig< Data = any, Fn extends fetcherFn = fetcherFn > { refreshInterval?: number cache?: LocalStorageCache | SWRVCache dedupingInterval?: number ttl?: number serverTTL?: number revalidateOnFocus?: boolean revalidateDebounce?: number shouldRetryOnError?: boolean | ((err: Error) => boolean) errorRetryInterval?: number errorRetryCount?: number fetcher?: Fn, isOnline?: () => boolean isDocumentVisible?: () => boolean } export interface revalidateOptions { shouldRetryOnError?: boolean | ((err: Error) => boolean), errorRetryCount?: number, forceRevalidate?: boolean, } export interface IResponse { data: Ref error: Ref isValidating: Ref isLoading: Ref mutate: (data?: fetcherFn, opts?: revalidateOptions) => Promise } export type keyType = string | any[] | null | undefined export type IKey = keyType | WatchSource