Skip to content

Commit

Permalink
Merge pull request #62 from Codex-/timeout_typings
Browse files Browse the repository at this point in the history
Timeout typings
  • Loading branch information
jessetane authored Mar 19, 2019
2 parents e9285cf + bb2bd74 commit ca775c0
Show file tree
Hide file tree
Showing 4 changed files with 801 additions and 791 deletions.
5 changes: 5 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ export default Queue;

export interface QueueWorker {
(callback?: QueueWorkerCallback): void;

/**
* Override queue timeout.
*/
timeout?: number;
}

export interface QueueWorkerCallback {
Expand Down
5 changes: 5 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ expectType<Options>({ results: [0, 'a', true, undefined, NaN] });
expectType<QueueWorker>(() => undefined);
expectType<QueueWorker>((callback: QueueWorkerCallback) => undefined);

function withTimeout() { }
withTimeout.timeout = 1;

expectType<QueueWorker>(withTimeout);

expectType<QueueWorkerCallback>(() => undefined);
expectType<QueueWorkerCallback>((data: Error) => undefined);
expectType<QueueWorkerCallback>((error: Error) => undefined);
Expand Down
Loading

0 comments on commit ca775c0

Please sign in to comment.