RepoPilot

What is the type signature of the main exported function?

About sindresorhus/get-port · 2 messages · last activity 7/27/2026

Question

What is the type signature of the main exported function?

RepoPilot

The main exported function getPort has the following type signature [index.d.ts:L66]:

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

This means:

  • It's the default export
  • It accepts an optional options parameter of type Options
  • It returns a Promise that resolves to a number (the available port)

The Options type is defined in [index.d.ts:L3-L65] and includes properties like port, exclude, reserve, and host, along with additional network options inherited from Node.js's ListenOptions.

FOLLOW_UPS:

  • What properties can I pass in the Options parameter?
  • How does the reserve option differ from default behavior?
  • Can I exclude specific ports from being selected?

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.