Skip to content

Commit

Permalink
fix: correct dev notes on the type-guard
Browse files Browse the repository at this point in the history
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta committed Sep 25, 2023
1 parent 79c7284 commit 8927b2b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -844,5 +844,7 @@ function updateAppInfo(
}

function isAddressInfo(arg: unknown): arg is Pick<AddressInfo, 'port'> {
return isObject<AddressInfo>(arg) && typeof arg.port === 'number'; // `family` might be
// Cannot do the type-guard on all properties, but the port is sufficient as the address is always `localhost`.
// For example, the `family` might be absent if the address is IPv6.
return isObject<AddressInfo>(arg) && typeof arg.port === 'number';
}

0 comments on commit 8927b2b

Please sign in to comment.