export type TRetryOptions = { backoff?: number; baseDelay?: number; maxDelay?: number; maxRetries?: number; onRetry?: (error: unknown, retry: number) => void; shouldRetry?: (error: unknown, retry: number) => boolean | Promise; signal?: AbortSignal | null; }; export type TGetRetriedFnArgs = Parameters; export type TGetRetriedFnReturn = ReturnType; /** * Returns an async function that retries rejected calls with exponential backoff. * @template T * @param {T} fn Source function * @param {TRetryOptions} [options={}] Retry policy * @returns {(...args: Parameters) => Promise>>} Retrying function * @throws {TypeError} getRetriedFn: options are invalid * @example * const loadWithRetry = getRetriedFn(loadData, { maxRetries: 2, baseDelay: 100 }); * @example * // Retry a transient API request with exponential backoff and cancellation * const controller = new AbortController(); * const fetchWithRetry = getRetriedFn(fetchProducts, { * maxRetries: 3, * baseDelay: 250, * signal: controller.signal, * }); */ export declare const getRetriedFn: any>(fn: T, options?: TRetryOptions) => ((...args: Parameters) => Promise>>);