Fix async-retry's exports

The exports of the package async-retry were misrepresenting the
original package's.
This commit is contained in:
Pablo Rodríguez
2018-03-25 21:18:27 +02:00
parent 106d393592
commit e43d96d643
2 changed files with 22 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
import { Options, RetryFunction, retry } from 'async-retry';
import { Options, RetryFunction } from 'async-retry';
import retry = require("async-retry");
const o: Options = {
retries: 1,

View File

@@ -1,17 +1,27 @@
// Type definitions for async-retry 1.1
// Type definitions for async-retry 1.2
// Project: https://github.com/zeit/async-retry#readme
// Definitions by: Albert Wu <https://github.com/albertywu>
// Pablo Rodríguez <https://github.com/MeLlamoPablo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function retry<A>(fn: RetryFunction<A>, opts: Options): Promise<A>;
declare function AsyncRetry<A>(
fn: AsyncRetry.RetryFunction<A>,
opts: AsyncRetry.Options
): Promise<A>;
export interface Options {
retries?: number;
factor?: number;
minTimeout?: number;
maxTimeout?: number;
randomize?: boolean;
onRetry?: (e: Error) => any;
declare namespace AsyncRetry {
function retry<A>(fn: RetryFunction<A>, opts: Options): Promise<A>;
interface Options {
retries?: number;
factor?: number;
minTimeout?: number;
maxTimeout?: number;
randomize?: boolean;
onRetry?: (e: Error) => any;
}
type RetryFunction<A> = (bail: (e: Error) => A, attempt: number) => A|Promise<A>;
}
export type RetryFunction<A> = (bail: (e: Error) => A, attempt: number) => A|Promise<A>;
export = AsyncRetry;