From d4bb1bd1e486a0887d2dd30ce9cb4dccca341a5c Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Tue, 8 Aug 2017 22:35:03 +0200 Subject: [PATCH] [public-ip] add typings (#18752) --- types/public-ip/index.d.ts | 12 ++++++++++++ types/public-ip/public-ip-tests.ts | 16 ++++++++++++++++ types/public-ip/tsconfig.json | 22 ++++++++++++++++++++++ types/public-ip/tslint.json | 1 + 4 files changed, 51 insertions(+) create mode 100644 types/public-ip/index.d.ts create mode 100644 types/public-ip/public-ip-tests.ts create mode 100644 types/public-ip/tsconfig.json create mode 100644 types/public-ip/tslint.json diff --git a/types/public-ip/index.d.ts b/types/public-ip/index.d.ts new file mode 100644 index 0000000000..463a1a2d18 --- /dev/null +++ b/types/public-ip/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for public-ip 2.3 +// Project: https://github.com/sindresorhus/public-ip#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function v4(options?: Options): Promise; +export function v6(options?: Options): Promise; + +export interface Options { + https?: boolean; + timeout?: number; +} diff --git a/types/public-ip/public-ip-tests.ts b/types/public-ip/public-ip-tests.ts new file mode 100644 index 0000000000..e7e0540bbe --- /dev/null +++ b/types/public-ip/public-ip-tests.ts @@ -0,0 +1,16 @@ +import * as publicIp from 'public-ip'; + +let str: string; +publicIp.v4().then(ip => { + str = ip; +}); +publicIp.v4({https: false, timeout: 10}).then(ip => { + str = ip; +}); + +publicIp.v6().then(ip => { + str = ip; +}); +publicIp.v6({https: false, timeout: 10}).then(ip => { + str = ip; +}); diff --git a/types/public-ip/tsconfig.json b/types/public-ip/tsconfig.json new file mode 100644 index 0000000000..88c711afc2 --- /dev/null +++ b/types/public-ip/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "public-ip-tests.ts" + ] +} diff --git a/types/public-ip/tslint.json b/types/public-ip/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/public-ip/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }