Merge pull request #31343 from BendingBender/default-gateway

Add types for default-gateway
This commit is contained in:
Nathan Shively-Sanders
2018-12-17 13:13:26 -08:00
committed by GitHub
4 changed files with 52 additions and 0 deletions
@@ -0,0 +1,11 @@
import * as defaultGateway from 'default-gateway';
defaultGateway.v4().then(result => {
result; // $ExpectType Gateway
});
defaultGateway.v6().then(result => {
result; // $ExpectType Gateway
});
defaultGateway.v4.sync(); // $ExpectType Gateway
defaultGateway.v6.sync(); // $ExpectType Gateway
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for default-gateway 3.0
// Project: https://github.com/silverwind/default-gateway#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export const v4: DefaultGatewayFn;
export const v6: DefaultGatewayFn;
export interface DefaultGatewayFn {
(): Promise<Gateway>;
sync(): Gateway;
}
export interface Gateway {
gateway: string;
interface: string | null;
}
+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",
"default-gateway-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }