What is the type signature of the main exported function?
What is the type signature of the main exported function?
About sindresorhus/get-port · 2 messages · last activity 6/8/2026
Based on the README excerpt, the main exported function getPort has this signature:
Function: getPort(options?)
Returns: Promise<number> (a Promise for a port number)
Options parameter type: object with the following optional properties:
port:number | Iterable<number>— A preferred port or iterable of preferred portsexclude:Iterable<number>— Ports that should not be returnedreserve:boolean(default:false) — Whether to reserve the port for the process lifetimehost:string— The host for port resolution (IPv4 or IPv6 address)
However, I should note that the index coverage for this repository is minimal (8 of 8 eligible files), and the README doesn't show the actual TypeScript type definitions. To see the precise type signature with all details, you'll want to check the main implementation file directly, likely index.ts or index.d.ts in the root or src/ directory.
FOLLOW_UPS:
- How does the port reservation feature work internally?
- What happens when all preferred ports are unavailable?
- How are IPv4 vs IPv6 addresses handled differently?
Want to ask your own question?
Open chat for sindresorhus/get-port →Public 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.