mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-05 09:40:02 +00:00
[@types/localtunnel] Updated to v2 (#42451)
This commit is contained in:
44
types/localtunnel/index.d.ts
vendored
44
types/localtunnel/index.d.ts
vendored
@@ -1,42 +1,60 @@
|
||||
// Type definitions for localtunnel 1.9
|
||||
// Type definitions for localtunnel 2.0
|
||||
// Project: https://github.com/localtunnel/localtunnel
|
||||
// Definitions by: Vladyslav Khrapov <https://github.com/vladhrapov>
|
||||
// Noam Alffasy <https://github.com/noamalffasy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
export = localtunnel;
|
||||
|
||||
declare function localtunnel(
|
||||
port: number,
|
||||
opt: localtunnel.TunnelConfig,
|
||||
callback: localtunnel.TunnelCallback
|
||||
port: number | localtunnel.TunnelConfig & { port: number }
|
||||
): Promise<localtunnel.Tunnel>;
|
||||
|
||||
declare function localtunnel(
|
||||
opts: localtunnel.TunnelConfig & { port: number },
|
||||
callback: localtunnel.TunnelCallback,
|
||||
): localtunnel.Tunnel;
|
||||
|
||||
declare function localtunnel(
|
||||
port: number,
|
||||
callback: localtunnel.TunnelCallback
|
||||
opts: localtunnel.TunnelConfig
|
||||
): Promise<localtunnel.Tunnel>;
|
||||
|
||||
declare function localtunnel(
|
||||
port: number,
|
||||
opts: localtunnel.TunnelConfig,
|
||||
callback: localtunnel.TunnelCallback,
|
||||
): localtunnel.Tunnel;
|
||||
|
||||
declare namespace localtunnel {
|
||||
type TunnelCallback = (
|
||||
err: string,
|
||||
err?: string,
|
||||
tunnel?: Tunnel
|
||||
) => void;
|
||||
|
||||
interface TunnelConfig {
|
||||
host?: string;
|
||||
subdomain?: string;
|
||||
port?: number;
|
||||
host?: string;
|
||||
local_host?: string;
|
||||
local_https?: boolean;
|
||||
local_cert?: string;
|
||||
local_key?: string;
|
||||
local_ca?: string;
|
||||
allow_invalid_cert?: boolean;
|
||||
}
|
||||
|
||||
interface Tunnel {
|
||||
interface Tunnel extends EventEmitter {
|
||||
url: string;
|
||||
tunnel_cluster: TunnelCluster;
|
||||
open(err: string, tunnel?: Tunnel): void;
|
||||
tunnelCluster: TunnelCluster;
|
||||
open(cb: ((err: string) => void) | (() => void)): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
interface TunnelCluster {
|
||||
domain: string;
|
||||
interface TunnelCluster extends EventEmitter {
|
||||
open(): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,54 @@
|
||||
import localtunnel = require('localtunnel');
|
||||
|
||||
let tunnel: localtunnel.Tunnel;
|
||||
let tunnel: localtunnel.Tunnel | Promise<localtunnel.Tunnel>;
|
||||
|
||||
tunnel = localtunnel(3000, () => {});
|
||||
tunnel = localtunnel(3000);
|
||||
tunnel = localtunnel({
|
||||
subdomain: '',
|
||||
host: '',
|
||||
local_host: '',
|
||||
local_https: true,
|
||||
local_cert: '',
|
||||
local_key: '',
|
||||
local_ca: '',
|
||||
allow_invalid_cert: true,
|
||||
port: 3000,
|
||||
});
|
||||
tunnel = localtunnel(
|
||||
{
|
||||
subdomain: '',
|
||||
host: '',
|
||||
local_host: '',
|
||||
local_https: true,
|
||||
local_cert: '',
|
||||
local_key: '',
|
||||
local_ca: '',
|
||||
allow_invalid_cert: true,
|
||||
port: 3000,
|
||||
},
|
||||
() => {},
|
||||
);
|
||||
tunnel = localtunnel(3000, {
|
||||
subdomain: '',
|
||||
host: '',
|
||||
local_host: '',
|
||||
local_https: true,
|
||||
local_cert: '',
|
||||
local_key: '',
|
||||
local_ca: '',
|
||||
allow_invalid_cert: true,
|
||||
});
|
||||
tunnel = localtunnel(
|
||||
3000,
|
||||
{ host: '', local_host: '', port: 3000, subdomain: '' },
|
||||
() => {}
|
||||
{
|
||||
subdomain: '',
|
||||
host: '',
|
||||
local_host: '',
|
||||
local_https: true,
|
||||
local_cert: '',
|
||||
local_key: '',
|
||||
local_ca: '',
|
||||
allow_invalid_cert: true,
|
||||
},
|
||||
() => {},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user