mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
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:
Vendored
+9
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(() => {});
|
||||
|
||||
Reference in New Issue
Block a user