import { DependencyList } from 'react'; import { FunctionReturningPromise, PromiseType } from './misc/types'; export declare type AsyncState = { loading: boolean; error?: undefined; value?: undefined; } | { loading: true; error?: Error | undefined; value?: T; } | { loading: false; error: Error; value?: undefined; } | { loading: false; error?: undefined; value: T; }; declare type StateFromFunctionReturningPromise = AsyncState>>; export declare type AsyncFnReturn = [ StateFromFunctionReturningPromise, T ]; export default function useAsyncFn(fn: T, deps?: DependencyList, initialState?: StateFromFunctionReturningPromise): AsyncFnReturn; export {};