Update types for internal-ip to v3

This commit is contained in:
Dimitri Benin
2018-12-12 23:42:56 +01:00
parent 972070c4d0
commit 068878f003
4 changed files with 51 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for internal-ip 3.0
// Project: https://github.com/sindresorhus/internal-ip#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export const v6: IPGetterFn;
export const v4: IPGetterFn;
export interface IPGetterFn { // tslint:disable-line:interface-name
(): Promise<string | null>;
sync(): string | null;
}
+15
View File
@@ -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();
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }