Merge pull request #29905 from wyze/p-wait-for-2.0

Update types for p-wait-for to v2.0
This commit is contained in:
Daniel Rosenwasser
2018-11-01 15:08:32 -07:00
committed by GitHub
2 changed files with 13 additions and 4 deletions
+9 -2
View File
@@ -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 <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = pWaitFor;
declare function pWaitFor(condition: () => PromiseLike<boolean> | boolean, interval?: number): Promise<void>;
declare function pWaitFor(condition: () => PromiseLike<boolean> | boolean, options?: pWaitFor.Options): Promise<void>;
declare namespace pWaitFor {
interface Options {
interval?: number;
timeout?: number;
}
}
+4 -2
View File
@@ -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(() => {});