Skip to content

Commit

Permalink
Allow failed event handler to return Promise<void> or number
Browse files Browse the repository at this point in the history
The type for the `failed` event only allowed you to return a `Promise<number>` or `void`.  However, you might want to return a `number` synchronously, or return `void` asynchronously.  This change allows those other cases in the `failed` event handler.
  • Loading branch information
dobesv authored Jun 7, 2019
1 parent dfcb837 commit fa6e034
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bottleneck.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ declare module "bottleneck" {
on(name: "queued", fn: (info: Bottleneck.EventInfoQueued) => void): void;
on(name: "scheduled", fn: (info: Bottleneck.EventInfo) => void): void;
on(name: "executing", fn: (info: Bottleneck.EventInfoRetryable) => void): void;
on(name: "failed", fn: (error: any, info: Bottleneck.EventInfoRetryable) => Promise<number> | void): void;
on(name: "failed", fn: (error: any, info: Bottleneck.EventInfoRetryable) => Promise<number | void> | number | void): void;
on(name: "retry", fn: (message: string, info: Bottleneck.EventInfoRetryable) => void): void;
on(name: "done", fn: (info: Bottleneck.EventInfoRetryable) => void): void;

Expand All @@ -511,7 +511,7 @@ declare module "bottleneck" {
once(name: "queued", fn: (info: Bottleneck.EventInfoQueued) => void): void;
once(name: "scheduled", fn: (info: Bottleneck.EventInfo) => void): void;
once(name: "executing", fn: (info: Bottleneck.EventInfoRetryable) => void): void;
once(name: "failed", fn: (error: any, info: Bottleneck.EventInfoRetryable) => Promise<number> | void): void;
once(name: "failed", fn: (error: any, info: Bottleneck.EventInfoRetryable) => Promise<number | void> | number | void): void;
once(name: "retry", fn: (message: string, info: Bottleneck.EventInfoRetryable) => void): void;
once(name: "done", fn: (info: Bottleneck.EventInfoRetryable) => void): void;

Expand Down

0 comments on commit fa6e034

Please sign in to comment.