From 8fd711fc1fcb43f22e6dbb10382d27790c06d8c5 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Mon, 25 Feb 2019 20:24:12 +0100 Subject: [PATCH] [wait-for-localhost] Update types to v3.0 --- types/wait-for-localhost/index.d.ts | 22 +++++++++++++++++-- .../wait-for-localhost-tests.ts | 6 ++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/types/wait-for-localhost/index.d.ts b/types/wait-for-localhost/index.d.ts index 080c8a800c..e0262e563a 100644 --- a/types/wait-for-localhost/index.d.ts +++ b/types/wait-for-localhost/index.d.ts @@ -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 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = waitForLocalhost; -declare function waitForLocalhost(port?: number): Promise; +/** + * Wait for localhost to be ready. + */ +declare function waitForLocalhost(options?: waitForLocalhost.Options): Promise; + +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; + } +} diff --git a/types/wait-for-localhost/wait-for-localhost-tests.ts b/types/wait-for-localhost/wait-for-localhost-tests.ts index 95d43efee2..a4f95b9622 100644 --- a/types/wait-for-localhost/wait-for-localhost-tests.ts +++ b/types/wait-for-localhost/wait-for-localhost-tests.ts @@ -1,5 +1,5 @@ import waitForLocalhost = require('wait-for-localhost'); -// $ExpectType Promise -waitForLocalhost(); -waitForLocalhost(8080); +waitForLocalhost(); // $ExpectType Promise +waitForLocalhost({ port: 8080 }); // $ExpectType Promise +waitForLocalhost({ useGet: true }); // $ExpectType Promise