mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-11 02:07:15 +00:00
18 lines
569 B
TypeScript
18 lines
569 B
TypeScript
// Type definitions for async-retry 1.1
|
|
// Project: https://github.com/zeit/async-retry#readme
|
|
// Definitions by: Albert Wu <https://github.com/albertywu>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
export function retry<A>(fn: RetryFunction<A>, opts: Options): Promise<A>;
|
|
|
|
export interface Options {
|
|
retries?: number;
|
|
factor?: number;
|
|
minTimeout?: number;
|
|
maxTimeout?: number;
|
|
randomize?: boolean;
|
|
onRetry?: (e: Error) => any;
|
|
}
|
|
|
|
export type RetryFunction<A> = (bail: (e: Error) => A, attempt: number) => A|Promise<A>;
|