mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Add localtunnel type definitions
This commit is contained in:
44
types/localtunnel/index.d.ts
vendored
Normal file
44
types/localtunnel/index.d.ts
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// Type definitions for localtunnel v1.9.1
|
||||
// Project: https://github.com/vladhrapov/typings
|
||||
// Definitions by: Vladyslav Khrapov <https://github.com/vladhrapov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function localtunnel(
|
||||
port: number,
|
||||
callback: localtunnel.TunnelCallback
|
||||
): localtunnel.Tunnel;
|
||||
|
||||
declare function localtunnel(
|
||||
port: number,
|
||||
opt: localtunnel.TunnelConfig,
|
||||
callback: localtunnel.TunnelCallback
|
||||
): localtunnel.Tunnel;
|
||||
|
||||
declare namespace localtunnel {
|
||||
export type TunnelCallback = (
|
||||
err: string,
|
||||
tunnel?: localtunnel.Tunnel
|
||||
) => void;
|
||||
|
||||
export interface TunnelConfig {
|
||||
host?: string;
|
||||
subdomain?: string;
|
||||
port?: number;
|
||||
local_host?: string;
|
||||
}
|
||||
|
||||
export interface Tunnel {
|
||||
url: string;
|
||||
tunnel_cluster: TunnelCluster;
|
||||
open(err: string, tunnel?: localtunnel.Tunnel): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
export interface TunnelCluster {
|
||||
domain: string;
|
||||
}
|
||||
|
||||
const prototype: {};
|
||||
}
|
||||
|
||||
export = localtunnel;
|
||||
10
types/localtunnel/localtunnel-tests.ts
Normal file
10
types/localtunnel/localtunnel-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import localtunnel = require('localtunnel');
|
||||
|
||||
let tunnel: localtunnel.Tunnel;
|
||||
|
||||
tunnel = localtunnel(3000, () => {});
|
||||
tunnel = localtunnel(
|
||||
3000,
|
||||
{ host: '', local_host: '', port: 3000, subdomain: '' },
|
||||
() => {}
|
||||
);
|
||||
23
types/localtunnel/tsconfig.json
Normal file
23
types/localtunnel/tsconfig.json
Normal 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",
|
||||
"localtunnel-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/localtunnel/tslint.json
Normal file
1
types/localtunnel/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user