RepoPilot

What is the type signature of the main exported function?

About sindresorhus/get-port · 2 messages · last activity 9/1/2026

Question

What is the type signature of the main exported function?

RepoPilot

The main exported function getPort has the following type signature:

export default function getPort(options?: Options): Promise<number>;

[index.d.ts:L66]

This function returns a Promise that resolves to a number representing an available TCP port. The options parameter is optional and of type Options, which allows you to specify preferences like:

  • port: a preferred port number or iterable of port numbers
  • exclude: ports to skip
  • reserve: whether to lock the port for the process lifetime
  • host: a specific host to check availability on

FOLLOW_UPS:

  • What properties does the Options interface include?
  • How does the function handle unavailable preferred ports?
  • What does the reserve option do exactly?

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.