forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DefinitelyTyped#34551 from vladhrapov/localtunnel
feat(DefinitelyTyped#34550): [@types/localtunnel] Create localtunnel type definitions
- Loading branch information
Showing
4 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Type definitions for localtunnel 1.9 | ||
// Project: https://github.com/localtunnel/localtunnel | ||
// Definitions by: Vladyslav Khrapov <https://github.com/vladhrapov> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
export = localtunnel; | ||
|
||
declare function localtunnel( | ||
port: number, | ||
opt: localtunnel.TunnelConfig, | ||
callback: localtunnel.TunnelCallback | ||
): localtunnel.Tunnel; | ||
|
||
declare function localtunnel( | ||
port: number, | ||
callback: localtunnel.TunnelCallback | ||
): localtunnel.Tunnel; | ||
|
||
declare namespace localtunnel { | ||
type TunnelCallback = ( | ||
err: string, | ||
tunnel?: Tunnel | ||
) => void; | ||
|
||
interface TunnelConfig { | ||
host?: string; | ||
subdomain?: string; | ||
port?: number; | ||
local_host?: string; | ||
} | ||
|
||
interface Tunnel { | ||
url: string; | ||
tunnel_cluster: TunnelCluster; | ||
open(err: string, tunnel?: Tunnel): void; | ||
close(): void; | ||
} | ||
|
||
interface TunnelCluster { | ||
domain: string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import localtunnel = require('localtunnel'); | ||
|
||
let tunnel: localtunnel.Tunnel; | ||
|
||
tunnel = localtunnel(3000, () => {}); | ||
tunnel = localtunnel( | ||
3000, | ||
{ host: '', local_host: '', port: 3000, subdomain: '' }, | ||
() => {} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "extends": "dtslint/dt.json" } |