Skip to content

Commit

Permalink
Add TypeScript definition
Browse files Browse the repository at this point in the history
  • Loading branch information
sebald committed Feb 20, 2019
1 parent 9ff9ff0 commit a383d97
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
export default function getPort(options?:{
port?: number | number[],
/**
* Options to configure how to find an available port.
*/
export type Options = Readonly<{
/**
* A preferred port or an array of preferred ports to use.
*/
port?: number | ReadonlyArray<number>,

/**
* The host on which port resolution should be performed. Can be either an IPv4 or IPv6 address.
*/
host?: string;
}): Promise<number>;
}>;

/**
* Returns a `Promise` for an available port number.
*
* @param options
* @returns Available port number.
*/
export default function getPort(options?:Options): Promise<number>;

0 comments on commit a383d97

Please sign in to comment.