1 | // Type definitions for async-retry 1.4
|
2 | // Project: https://github.com/zeit/async-retry#readme
|
3 | // Definitions by: Albert Wu <https://github.com/albertywu>
|
4 | // Pablo Rodríguez <https://github.com/MeLlamoPablo>
|
5 | // Rafał Sawicki <https://github.com/rafsawicki>
|
6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
7 | // TypeScript Version: 2.3
|
8 |
|
9 | import { WrapOptions } from 'retry';
|
10 |
|
11 | declare function AsyncRetry<A>(
|
12 | fn: AsyncRetry.RetryFunction<A>,
|
13 | opts?: AsyncRetry.Options
|
14 | ): Promise<A>;
|
15 |
|
16 | declare namespace AsyncRetry {
|
17 | interface Options extends WrapOptions {
|
18 | onRetry?: ((e: Error, attempt: number) => any) | undefined;
|
19 | }
|
20 |
|
21 | type RetryFunction<A> = (bail: (e: Error) => void, attempt: number) => A|Promise<A>;
|
22 | }
|
23 |
|
24 | export = AsyncRetry;
|