Change async-retry options to use retry library types

Since async-retry is passing options parameter directly to the underlying retry library, option types can be reused from it.
This commit is contained in:
Rafal Sawicki
2019-04-04 11:44:27 +02:00
committed by Rafał Sawicki
parent 510793441f
commit 8908cbdb45
2 changed files with 6 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ const o: Options = {
minTimeout: 3,
maxTimeout: 4,
randomize: true,
forever: false,
onRetry: (e: Error) => 42
};

View File

@@ -1,21 +1,19 @@
// Type definitions for async-retry 1.3
// Type definitions for async-retry 1.4
// Project: https://github.com/zeit/async-retry#readme
// Definitions by: Albert Wu <https://github.com/albertywu>
// Pablo Rodríguez <https://github.com/MeLlamoPablo>
// Rafał Sawicki <https://github.com/rafsawicki>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { OperationOptions } from 'retry';
declare function AsyncRetry<A>(
fn: AsyncRetry.RetryFunction<A>,
opts: AsyncRetry.Options
): Promise<A>;
declare namespace AsyncRetry {
interface Options {
retries?: number;
factor?: number;
minTimeout?: number;
maxTimeout?: number;
randomize?: boolean;
interface Options extends OperationOptions {
onRetry?: (e: Error, attempt: number) => any;
}