import type { AnyFunction, CancelableFunction } from 'tachyon-type-library'; import type { PromiseValue } from 'type-fest'; export interface PollingFn extends CancelableFunction { (...args: Parameters): Promise>>; } export declare const CANCELLED_PROMISE_ERROR_MESSAGE = "canceled promise"; export declare const CANCELLED_PROMISE_ERROR: Error; export type PollOpts = { intervalMs: number; timeoutMs?: number; }; /** * Creates a polling function that repeatedly invokes `fn` every `intervalMs` * until fn sucessfully returns, is cancelled, or `timeoutMs` elapses. * * @param {Function} fn The function to poll. * @param {number} [intervalMs] * The number of milliseconds to wait between invokations of fn. * @param {number} [timeoutMs=Infinity] The total number of milliseconds to * poll. */ export declare function poll(fn: Fn, { intervalMs, timeoutMs }: PollOpts): PollingFn; //# sourceMappingURL=index.d.ts.map