import type { DependencyList } from 'react';
export declare type IRequestStatus = 'NONE' | 'PENDING' | 'REJECTED' | 'RESOLVED';
export interface IUseLatestPromiseResult<T> {
    result: T;
    status: IRequestStatus;
    error: any;
    refresh: () => void;
    requestId: number;
}
/**
 * A react hook which invokes a callback that returns a promise.
 * If multiple requests are made concurrently, only returns data from the latest request.
 *
 * This can be useful when fetching data based on a users keyboard input, for example.
 * This behavior is similar to RxJS switchMap.
 *
 * example:
 * const fetch = useLatestPromise(() => fetch(url + '?foo=" + foo).then(x=>x.json()), [foo]);
 * return (fetch.status === 'RESOLVED' ? <pre>{JSON.stringify(fetch.result, null, 2)}</pre> :
 *         fetch.status === 'REJECTED' ? <span>Error: {fetch.error}</span> :
 *         fetch.status === 'PENDING' ? <span>Loading...</span> : null);
 *
 * @param callback a callback that returns a PromiseLike
 * @param deps array of dependencies, which (when changed) cause the callback to be invoked again
 * @returns an object with the result and current status of the promise
 */
export declare function useLatestPromise<T>(callback: () => PromiseLike<T>, deps: DependencyList): IUseLatestPromiseResult<T>;
