From 8fc20e185100985a09ac78a7a26d707890c83541 Mon Sep 17 00:00:00 2001 From: Neil Kistner Date: Sat, 20 Oct 2018 09:30:05 -0500 Subject: [PATCH] Update types for p-wait-for to v2.0 --- types/p-wait-for/index.d.ts | 11 +++++++++-- types/p-wait-for/p-wait-for-tests.ts | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/types/p-wait-for/index.d.ts b/types/p-wait-for/index.d.ts index 5e8f88d413..d7fa76e016 100644 --- a/types/p-wait-for/index.d.ts +++ b/types/p-wait-for/index.d.ts @@ -1,8 +1,15 @@ -// Type definitions for p-wait-for 1.0 +// Type definitions for p-wait-for 2.0 // Project: https://github.com/sindresorhus/p-wait-for#readme // Definitions by: BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = pWaitFor; -declare function pWaitFor(condition: () => PromiseLike | boolean, interval?: number): Promise; +declare function pWaitFor(condition: () => PromiseLike | boolean, options?: pWaitFor.Options): Promise; + +declare namespace pWaitFor { + interface Options { + interval?: number; + timeout?: number; + } +} diff --git a/types/p-wait-for/p-wait-for-tests.ts b/types/p-wait-for/p-wait-for-tests.ts index 587d08d5a5..ef23ef6526 100644 --- a/types/p-wait-for/p-wait-for-tests.ts +++ b/types/p-wait-for/p-wait-for-tests.ts @@ -1,6 +1,8 @@ import pWaitFor = require('p-wait-for'); pWaitFor(() => Promise.resolve(false)).then(() => {}); -pWaitFor(() => Promise.resolve(true), 1).then(() => {}); +pWaitFor(() => Promise.resolve(true), { interval: 1 }).then(() => {}); +pWaitFor(() => Promise.resolve(true), { timeout: 1 }).then(() => {}); pWaitFor(() => false).then(() => {}); -pWaitFor(() => true, 1).then(() => {}); +pWaitFor(() => true, { interval: 1 }).then(() => {}); +pWaitFor(() => true, { timeout: 1 }).then(() => {});