mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 06:29:40 +08:00
Fix async-retry's exports
The exports of the package async-retry were misrepresenting the original package's.
This commit is contained in:
@@ -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,
|
||||
|
||||
30
types/async-retry/index.d.ts
vendored
30
types/async-retry/index.d.ts
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user