From 58ad862cee25112615a68894dcc75a5a372c2f5c Mon Sep 17 00:00:00 2001 From: Mattias Holmlund Date: Tue, 15 Aug 2017 20:00:11 +0200 Subject: [PATCH] node: Add scopeid for IPv6 interfaces The scopeid field only exists if the interface is of family IPv6 https://nodejs.org/dist/latest-v6.x/docs/api/os.html#os_os_networkinterfaces --- types/node/index.d.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 52186217bd..99ca87cd46 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1379,14 +1379,25 @@ declare module "os" { }; } - export interface NetworkInterfaceInfo { + export interface NetworkInterfaceInfoIPv4 { address: string; netmask: string; - family: string; + family: "IPv4"; mac: string; internal: boolean; } + export interface NetworkInterfaceInfoIPv6 { + address: string; + netmask: string; + family: "IPv6"; + mac: string; + internal: boolean; + scopeid: number; + } + + export type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6; + export function hostname(): string; export function loadavg(): number[]; export function uptime(): number;