Skip to content

Commit

Permalink
[wait-for-localhost] Update types to v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BendingBender committed Feb 25, 2019
1 parent b1285da commit 8fd711f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
22 changes: 20 additions & 2 deletions types/wait-for-localhost/index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}
6 changes: 3 additions & 3 deletions types/wait-for-localhost/wait-for-localhost-tests.ts
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 8fd711f

Please sign in to comment.