Question
What is the type signature of the main exported function?
About sindresorhus/get-port · 2 messages · last activity 6/29/2026
What is the type signature of the main exported function?
The main exported function getPort has the following type signature [index.d.ts:L66]:
export default function getPort(options?: Options): Promise<number>;
It's an async function that accepts an optional Options object and returns a Promise<number> representing the available port number.
The Options type is defined in [index.d.ts:L3-L65] and includes:
port: A preferred port number or iterable of preferred portsexclude: An iterable of port numbers to exclude from considerationreserve: A boolean (default false) to reserve the port for the process lifetimehost: A string specifying the host (IPv4 or IPv6 address) for port resolutionListenOptionsFOLLOW_UPS:
Want to ask your own question?
Open chat for sindresorhus/get-portPublic Q&A. Generated by RepoPilot from the actual source of sindresorhus/get-port. AI answers can be incomplete or stale — verify before relying on them.