http-party / node-portfinder

A simple tool to find an open port or domain socket on the current machine
https://github.com/http-party/node-portfinder
Other
882 stars 95 forks source link

Add missing highestPort property to TypeScript definition #103

Closed brunogaspar closed 3 years ago

brunogaspar commented 4 years ago

Was causing warning about missing property.

Before:

before

After:

after

Signed-off-by: Bruno Gaspar brunofgaspar1@gmail.com

eriktrom commented 4 years ago

Ideally we want to make sure that the highest port does not exceed 65536 as this is the highest number of open file descriptors most development systems can have open. (an int in C is 4 bytes * (8 bits in a byte) == 4**8 = 65536

there is also a limitation with macos as it reserves the top 20,000 ports or so for root (wheel) access only. It uses these for the touchbar, which is controlled via a protocol that uses an FD as well.

that said, i don't recall off hand if typescript can type alias number with restrictions on the range or max size of a number, but if so, that'd be ideal...

(I'll check it out in the next 1.5 weeks, if you know, drop me a link or note)

thanks for the contribution @brunogaspar

brunogaspar commented 4 years ago

Hi @eriktrom

That does not seem entirely possible at the moment (it's quite limited), at least according to this open issue https://github.com/Microsoft/TypeScript/issues/15480

eriktrom commented 4 years ago

Thanks for the link. I’ll look further.