mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 12:42:58 +08:00
[public-ip] add typings (#18752)
This commit is contained in:
committed by
Mohamed Hegazy
parent
3e4bc214f3
commit
d4bb1bd1e4
12
types/public-ip/index.d.ts
vendored
Normal file
12
types/public-ip/index.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Type definitions for public-ip 2.3
|
||||
// Project: https://github.com/sindresorhus/public-ip#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function v4(options?: Options): Promise<string>;
|
||||
export function v6(options?: Options): Promise<string>;
|
||||
|
||||
export interface Options {
|
||||
https?: boolean;
|
||||
timeout?: number;
|
||||
}
|
||||
16
types/public-ip/public-ip-tests.ts
Normal file
16
types/public-ip/public-ip-tests.ts
Normal file
@@ -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;
|
||||
});
|
||||
22
types/public-ip/tsconfig.json
Normal file
22
types/public-ip/tsconfig.json
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
1
types/public-ip/tslint.json
Normal file
1
types/public-ip/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user