From 75445923a6f737fc21e3cf592f749bf014b7b4ce Mon Sep 17 00:00:00 2001 From: Mathieu TUDISCO Date: Wed, 24 Apr 2019 16:02:20 +0200 Subject: [PATCH] feat: Add typings (#15) --- lib/address.d.ts | 16 ++++++++++++++++ package.json | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 lib/address.d.ts diff --git a/lib/address.d.ts b/lib/address.d.ts new file mode 100644 index 0000000..8be04ff --- /dev/null +++ b/lib/address.d.ts @@ -0,0 +1,16 @@ +namespace address { + function ip(interfaceName?: string): string + + function ipv6(interfaceName?: string): string + + function mac(callback: (err: Error, addr: string) => void): void + function mac(interfaceName: string, callback: (err: Error, addr: string) => void): void + + function dns(callback: (err: Error, servers: string[]) => void): void + function dns(filePath: string, callback: (err: Error, servers: string[]) => void): void +} + +function address(callback: (err: Error, addr: { ip: string, ipv6: string, mac: string }) => void): void +function address(interfaceName: string, callback: (err: Error, addr: { ip: string, ipv6: string, mac: string }) => void): void + +export = address diff --git a/package.json b/package.json index ffbf017..4662724 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.3", "description": "Get current machine IP, MAC and DNS servers.", "main": "lib/address.js", + "types": "lib/address.d.ts", "files": [ "lib" ], @@ -43,4 +44,4 @@ }, "author": "fengmk2 ", "license": "MIT" -} \ No newline at end of file +}