Merge pull request #33391 from BendingBender/wait-for-localhost

[wait-for-localhost] Update types to v3.0
This commit is contained in:
Jesse Trinity
2019-02-26 13:03:27 -08:00
committed by GitHub
2 changed files with 23 additions and 5 deletions
+20 -2
View File
@@ -1,8 +1,26 @@
// Type definitions for wait-for-localhost 2.0
// Type definitions for wait-for-localhost 3.0
// Project: https://github.com/sindresorhus/wait-for-localhost#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = waitForLocalhost;
declare function waitForLocalhost(port?: number): Promise<void>;
/**
* Wait for localhost to be ready.
*/
declare function waitForLocalhost(options?: waitForLocalhost.Options): Promise<void>;
declare namespace waitForLocalhost {
interface Options {
/**
* @default 80
*/
port?: number;
/**
* Use the `GET` HTTP-method instead of `HEAD` to check if the server is running.
* @default false
*/
useGet?: boolean;
}
}
@@ -1,5 +1,5 @@
import waitForLocalhost = require('wait-for-localhost');
// $ExpectType Promise<void>
waitForLocalhost();
waitForLocalhost(8080);
waitForLocalhost(); // $ExpectType Promise<void>
waitForLocalhost({ port: 8080 }); // $ExpectType Promise<void>
waitForLocalhost({ useGet: true }); // $ExpectType Promise<void>