From 068878f003c62bab4cffa6766529ddf9fdc4c5b9 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Wed, 12 Dec 2018 23:42:56 +0100 Subject: [PATCH] Update types for internal-ip to v3 --- types/internal-ip/index.d.ts | 12 ++++++++++++ types/internal-ip/internal-ip-tests.ts | 15 +++++++++++++++ types/internal-ip/tsconfig.json | 23 +++++++++++++++++++++++ types/internal-ip/tslint.json | 1 + 4 files changed, 51 insertions(+) create mode 100644 types/internal-ip/index.d.ts create mode 100644 types/internal-ip/internal-ip-tests.ts create mode 100644 types/internal-ip/tsconfig.json create mode 100644 types/internal-ip/tslint.json diff --git a/types/internal-ip/index.d.ts b/types/internal-ip/index.d.ts new file mode 100644 index 0000000000..1bed7e9059 --- /dev/null +++ b/types/internal-ip/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for internal-ip 3.0 +// Project: https://github.com/sindresorhus/internal-ip#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export const v6: IPGetterFn; +export const v4: IPGetterFn; + +export interface IPGetterFn { // tslint:disable-line:interface-name + (): Promise; + sync(): string | null; +} diff --git a/types/internal-ip/internal-ip-tests.ts b/types/internal-ip/internal-ip-tests.ts new file mode 100644 index 0000000000..1b383de2f3 --- /dev/null +++ b/types/internal-ip/internal-ip-tests.ts @@ -0,0 +1,15 @@ +import * as internalIp from 'internal-ip'; + +internalIp.v6().then(ip => { + // $ExpectType string | null + ip; +}); +// $ExpectType string | null +internalIp.v6.sync(); + +internalIp.v4().then(ip => { + // $ExpectType string | null + ip; +}); +// $ExpectType string | null +internalIp.v4.sync(); diff --git a/types/internal-ip/tsconfig.json b/types/internal-ip/tsconfig.json new file mode 100644 index 0000000000..99d54932e0 --- /dev/null +++ b/types/internal-ip/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "internal-ip-tests.ts" + ] +} diff --git a/types/internal-ip/tslint.json b/types/internal-ip/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/internal-ip/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }