declare type UnknownResult = unknown; declare type UnknownArgs = any[]; export declare type AsyncStateStatus = 'not-requested' | 'loading' | 'success' | 'error'; export declare type AsyncState = { status: AsyncStateStatus; loading: boolean; error: Error | undefined; result: R | undefined; }; declare type SetLoading = (asyncState: AsyncState) => AsyncState; declare type SetResult = (result: R, asyncState: AsyncState) => AsyncState; declare type SetError = (error: Error, asyncState: AsyncState) => AsyncState; declare type MaybePromise = Promise | T; declare type PromiseCallbackOptions = { isCurrent: () => boolean; }; export declare type UseAsyncOptionsNormalized = { initialState: (options?: UseAsyncOptionsNormalized) => AsyncState; executeOnMount: boolean; executeOnUpdate: boolean; setLoading: SetLoading; setResult: SetResult; setError: SetError; onSuccess: (r: R, options: PromiseCallbackOptions) => void; onError: (e: Error, options: PromiseCallbackOptions) => void; }; export declare type UseAsyncOptions = Partial> | undefined | null; export declare type UseAsyncReturn = AsyncState & { set: (value: AsyncState) => void; merge: (value: Partial>) => void; reset: () => void; execute: (...args: Args) => Promise; currentPromise: Promise | null; currentParams: Args | null; }; export declare function useAsync(asyncFunction: () => Promise, params: Args, options?: UseAsyncOptions): UseAsyncReturn; export declare function useAsync(asyncFunction: (...args: Args) => Promise, params: Args, options?: UseAsyncOptions): UseAsyncReturn; declare type AddArg = ((h: H, ...t: T) => void) extends ((...r: infer R) => void) ? R : never; export declare const useAsyncAbortable: (asyncFunction: (...args: AddArg) => Promise, params: Args, options?: UseAsyncOptions) => UseAsyncReturn; declare type LegacyOmit = Pick>; export declare type UseAsyncCallbackOptions = LegacyOmit>, 'executeOnMount' | 'executeOnUpdate' | 'initialState'> | undefined | null; export declare const useAsyncCallback: (asyncFunction: (...args: Args) => MaybePromise, options?: UseAsyncCallbackOptions) => UseAsyncReturn; export declare const useAsyncFetchMore: ({ value, fetchMore, merge, isEnd: isEndFn, }: { value: UseAsyncReturn; fetchMore: (result: R) => Promise; merge: (result: R, moreResult: R) => R; isEnd: (moreResult: R) => boolean; }) => { canFetchMore: boolean; loading: boolean; status: AsyncStateStatus; fetchMore: () => Promise; isEnd: boolean; }; export {};