mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
chore(node): reduce usage of Function (#33527)
This commit is contained in:
committed by
Wesley Wigham
parent
5544e7433f
commit
1eeccafd4e
@@ -30,7 +30,7 @@ declare namespace adone.collection {
|
||||
/**
|
||||
* Ends the stream
|
||||
*/
|
||||
end(chunk?: Buffer): void;
|
||||
end(chunk?: Buffer | string): void;
|
||||
end(chunk?: () => void): void;
|
||||
|
||||
/**
|
||||
|
||||
4
types/bunyan/index.d.ts
vendored
4
types/bunyan/index.d.ts
vendored
@@ -259,7 +259,7 @@ declare namespace Logger {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
class RingBuffer extends EventEmitter implements NodeJS.WritableStream {
|
||||
class RingBuffer extends EventEmitter {
|
||||
constructor(options: RingBufferOptions);
|
||||
|
||||
writable: boolean;
|
||||
@@ -277,7 +277,7 @@ declare namespace Logger {
|
||||
period?: string;
|
||||
}
|
||||
|
||||
class RotatingFileStream extends EventEmitter implements NodeJS.WritableStream {
|
||||
class RotatingFileStream extends EventEmitter {
|
||||
constructor(options: RotatingFileStreamOptions);
|
||||
|
||||
writable: boolean;
|
||||
|
||||
16
types/node/assert.d.ts
vendored
16
types/node/assert.d.ts
vendored
@@ -33,17 +33,17 @@ declare module "assert" {
|
||||
function deepStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
||||
|
||||
function throws(block: Function, message?: string | Error): void;
|
||||
function throws(block: Function, error: RegExp | Function | Object | Error, message?: string | Error): void;
|
||||
function doesNotThrow(block: Function, message?: string | Error): void;
|
||||
function doesNotThrow(block: Function, error: RegExp | Function, message?: string | Error): void;
|
||||
function throws(block: () => any, message?: string | Error): void;
|
||||
function throws(block: () => any, error: RegExp | Function | Object | Error, message?: string | Error): void;
|
||||
function doesNotThrow(block: () => any, message?: string | Error): void;
|
||||
function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void;
|
||||
|
||||
function ifError(value: any): void;
|
||||
|
||||
function rejects(block: Function | Promise<any>, message?: string | Error): Promise<void>;
|
||||
function rejects(block: Function | Promise<any>, error: RegExp | Function | Object | Error, message?: string | Error): Promise<void>;
|
||||
function doesNotReject(block: Function | Promise<any>, message?: string | Error): Promise<void>;
|
||||
function doesNotReject(block: Function | Promise<any>, error: RegExp | Function, message?: string | Error): Promise<void>;
|
||||
function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
|
||||
function rejects(block: (() => Promise<any>) | Promise<any>, error: RegExp | Function | Object | Error, message?: string | Error): Promise<void>;
|
||||
function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
|
||||
function doesNotReject(block: (() => Promise<any>) | Promise<any>, error: RegExp | Function, message?: string | Error): Promise<void>;
|
||||
|
||||
const strict: typeof internal;
|
||||
}
|
||||
|
||||
28
types/node/cluster.d.ts
vendored
28
types/node/cluster.d.ts
vendored
@@ -92,7 +92,7 @@ declare module "cluster" {
|
||||
|
||||
interface Cluster extends events.EventEmitter {
|
||||
Worker: Worker;
|
||||
disconnect(callback?: Function): void;
|
||||
disconnect(callback?: () => void): void;
|
||||
fork(env?: any): Worker;
|
||||
isMaster: boolean;
|
||||
isWorker: boolean;
|
||||
@@ -121,7 +121,7 @@ declare module "cluster" {
|
||||
addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
addListener(event: "online", listener: (worker: Worker) => void): this;
|
||||
addListener(event: "setup", listener: (settings: any) => void): this;
|
||||
addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "disconnect", worker: Worker): boolean;
|
||||
@@ -130,7 +130,7 @@ declare module "cluster" {
|
||||
emit(event: "listening", worker: Worker, address: Address): boolean;
|
||||
emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
|
||||
emit(event: "online", worker: Worker): boolean;
|
||||
emit(event: "setup", settings: any): boolean;
|
||||
emit(event: "setup", settings: ClusterSettings): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
@@ -139,7 +139,7 @@ declare module "cluster" {
|
||||
on(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
on(event: "online", listener: (worker: Worker) => void): this;
|
||||
on(event: "setup", listener: (settings: any) => void): this;
|
||||
on(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
@@ -148,7 +148,7 @@ declare module "cluster" {
|
||||
once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
once(event: "online", listener: (worker: Worker) => void): this;
|
||||
once(event: "setup", listener: (settings: any) => void): this;
|
||||
once(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
@@ -157,7 +157,7 @@ declare module "cluster" {
|
||||
prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
||||
prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependListener(event: "online", listener: (worker: Worker) => void): this;
|
||||
prependListener(event: "setup", listener: (settings: any) => void): this;
|
||||
prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
||||
@@ -167,10 +167,10 @@ declare module "cluster" {
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this;
|
||||
prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
|
||||
prependOnceListener(event: "setup", listener: (settings: any) => void): this;
|
||||
prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
||||
}
|
||||
|
||||
function disconnect(callback?: Function): void;
|
||||
function disconnect(callback?: () => void): void;
|
||||
function fork(env?: any): Worker;
|
||||
const isMaster: boolean;
|
||||
const isWorker: boolean;
|
||||
@@ -200,7 +200,7 @@ declare module "cluster" {
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
function addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
|
||||
function addListener(event: "online", listener: (worker: Worker) => void): Cluster;
|
||||
function addListener(event: "setup", listener: (settings: any) => void): Cluster;
|
||||
function addListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
|
||||
|
||||
function emit(event: string | symbol, ...args: any[]): boolean;
|
||||
function emit(event: "disconnect", worker: Worker): boolean;
|
||||
@@ -209,7 +209,7 @@ declare module "cluster" {
|
||||
function emit(event: "listening", worker: Worker, address: Address): boolean;
|
||||
function emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
|
||||
function emit(event: "online", worker: Worker): boolean;
|
||||
function emit(event: "setup", settings: any): boolean;
|
||||
function emit(event: "setup", settings: ClusterSettings): boolean;
|
||||
|
||||
function on(event: string, listener: (...args: any[]) => void): Cluster;
|
||||
function on(event: "disconnect", listener: (worker: Worker) => void): Cluster;
|
||||
@@ -218,7 +218,7 @@ declare module "cluster" {
|
||||
function on(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
|
||||
function on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
function on(event: "online", listener: (worker: Worker) => void): Cluster;
|
||||
function on(event: "setup", listener: (settings: any) => void): Cluster;
|
||||
function on(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
|
||||
|
||||
function once(event: string, listener: (...args: any[]) => void): Cluster;
|
||||
function once(event: "disconnect", listener: (worker: Worker) => void): Cluster;
|
||||
@@ -227,7 +227,7 @@ declare module "cluster" {
|
||||
function once(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
|
||||
function once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
function once(event: "online", listener: (worker: Worker) => void): Cluster;
|
||||
function once(event: "setup", listener: (settings: any) => void): Cluster;
|
||||
function once(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
|
||||
|
||||
function removeListener(event: string, listener: (...args: any[]) => void): Cluster;
|
||||
function removeAllListeners(event?: string): Cluster;
|
||||
@@ -244,7 +244,7 @@ declare module "cluster" {
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
function prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
|
||||
function prependListener(event: "online", listener: (worker: Worker) => void): Cluster;
|
||||
function prependListener(event: "setup", listener: (settings: any) => void): Cluster;
|
||||
function prependListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
|
||||
|
||||
function prependOnceListener(event: string, listener: (...args: any[]) => void): Cluster;
|
||||
function prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): Cluster;
|
||||
@@ -254,7 +254,7 @@ declare module "cluster" {
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
function prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
|
||||
function prependOnceListener(event: "online", listener: (worker: Worker) => void): Cluster;
|
||||
function prependOnceListener(event: "setup", listener: (settings: any) => void): Cluster;
|
||||
function prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
|
||||
|
||||
function eventNames(): string[];
|
||||
}
|
||||
|
||||
11
types/node/crypto.d.ts
vendored
11
types/node/crypto.d.ts
vendored
@@ -185,10 +185,8 @@ declare module "crypto" {
|
||||
interface Cipher extends NodeJS.ReadWriteStream {
|
||||
update(data: BinaryLike): Buffer;
|
||||
update(data: string, input_encoding: Utf8AsciiBinaryEncoding): Buffer;
|
||||
update(data: Binary, output_encoding: HexBase64BinaryEncoding): string;
|
||||
update(data: Binary, input_encoding: any, output_encoding: HexBase64BinaryEncoding): string;
|
||||
// second arg ignored
|
||||
update(data: string, input_encoding: Utf8AsciiBinaryEncoding, output_encoding: HexBase64BinaryEncoding): string;
|
||||
update(data: Binary, input_encoding: undefined, output_encoding: HexBase64BinaryEncoding): string;
|
||||
update(data: string, input_encoding: Utf8AsciiBinaryEncoding | undefined, output_encoding: HexBase64BinaryEncoding): string;
|
||||
final(): Buffer;
|
||||
final(output_encoding: string): string;
|
||||
setAutoPadding(auto_padding?: boolean): this;
|
||||
@@ -227,9 +225,8 @@ declare module "crypto" {
|
||||
interface Decipher extends NodeJS.ReadWriteStream {
|
||||
update(data: Binary): Buffer;
|
||||
update(data: string, input_encoding: HexBase64BinaryEncoding): Buffer;
|
||||
update(data: Binary, input_encoding: any, output_encoding: Utf8AsciiBinaryEncoding): string;
|
||||
// second arg is ignored
|
||||
update(data: string, input_encoding: HexBase64BinaryEncoding, output_encoding: Utf8AsciiBinaryEncoding): string;
|
||||
update(data: Binary, input_encoding: undefined, output_encoding: Utf8AsciiBinaryEncoding): string;
|
||||
update(data: string, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string;
|
||||
final(): Buffer;
|
||||
final(output_encoding: string): string;
|
||||
setAutoPadding(auto_padding?: boolean): this;
|
||||
|
||||
2
types/node/dgram.d.ts
vendored
2
types/node/dgram.d.ts
vendored
@@ -39,7 +39,7 @@ declare module "dgram" {
|
||||
bind(port?: number, address?: string, callback?: () => void): void;
|
||||
bind(port?: number, callback?: () => void): void;
|
||||
bind(callback?: () => void): void;
|
||||
bind(options: BindOptions, callback?: Function): void;
|
||||
bind(options: BindOptions, callback?: () => void): void;
|
||||
close(callback?: () => void): void;
|
||||
address(): AddressInfo | string;
|
||||
setBroadcast(flag: boolean): void;
|
||||
|
||||
12
types/node/domain.d.ts
vendored
12
types/node/domain.d.ts
vendored
@@ -2,12 +2,12 @@ declare module "domain" {
|
||||
import * as events from "events";
|
||||
|
||||
class Domain extends events.EventEmitter implements NodeJS.Domain {
|
||||
run(fn: Function): void;
|
||||
add(emitter: events.EventEmitter): void;
|
||||
remove(emitter: events.EventEmitter): void;
|
||||
bind(cb: (err: Error, data: any) => any): any;
|
||||
intercept(cb: (data: any) => any): any;
|
||||
members: any[];
|
||||
run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
|
||||
add(emitter: events.EventEmitter | NodeJS.Timer): void;
|
||||
remove(emitter: events.EventEmitter | NodeJS.Timer): void;
|
||||
bind<T extends Function>(cb: T): T;
|
||||
intercept<T extends Function>(cb: T): T;
|
||||
members: Array<events.EventEmitter | NodeJS.Timer>;
|
||||
enter(): void;
|
||||
exit(): void;
|
||||
}
|
||||
|
||||
31
types/node/globals.d.ts
vendored
31
types/node/globals.d.ts
vendored
@@ -360,7 +360,7 @@ declare const Buffer: {
|
||||
* Creates a new Buffer using the passed {data}
|
||||
* @param data data to create a new Buffer
|
||||
*/
|
||||
from(data: any[]): Buffer;
|
||||
from(data: number[]): Buffer;
|
||||
from(data: Uint8Array): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
||||
@@ -611,12 +611,11 @@ declare namespace NodeJS {
|
||||
|
||||
interface WritableStream extends EventEmitter {
|
||||
writable: boolean;
|
||||
write(buffer: Buffer | string, cb?: Function): boolean;
|
||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
||||
end(cb?: Function): void;
|
||||
end(buffer: Buffer, cb?: Function): void;
|
||||
end(str: string, cb?: Function): void;
|
||||
end(str: string, encoding?: string, cb?: Function): void;
|
||||
write(buffer: Buffer | Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
||||
write(str: string, encoding?: string, cb?: (err?: Error | null) => void): boolean;
|
||||
end(cb?: () => void): void;
|
||||
end(data: string | Uint8Array | Buffer, cb?: () => void): void;
|
||||
end(str: string, encoding?: string, cb?: () => void): void;
|
||||
}
|
||||
|
||||
interface ReadWriteStream extends ReadableStream, WritableStream { }
|
||||
@@ -624,11 +623,11 @@ declare namespace NodeJS {
|
||||
interface Events extends EventEmitter { }
|
||||
|
||||
interface Domain extends Events {
|
||||
run(fn: Function): void;
|
||||
add(emitter: Events): void;
|
||||
remove(emitter: Events): void;
|
||||
bind(cb: (err: Error, data: any) => any): any;
|
||||
intercept(cb: (data: any) => any): any;
|
||||
run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
|
||||
add(emitter: EventEmitter | Timer): void;
|
||||
remove(emitter: EventEmitter | Timer): void;
|
||||
bind<T extends Function>(cb: T): T;
|
||||
intercept<T extends Function>(cb: T): T;
|
||||
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
@@ -712,9 +711,9 @@ declare namespace NodeJS {
|
||||
readonly writableLength: number;
|
||||
columns?: number;
|
||||
rows?: number;
|
||||
_write(chunk: any, encoding: string, callback: Function): void;
|
||||
_destroy(err: Error | null, callback: Function): void;
|
||||
_final(callback: Function): void;
|
||||
_write(chunk: any, encoding: string, callback: (err?: null | Error) => void): void;
|
||||
_destroy(err: Error | null, callback: (err?: null | Error) => void): void;
|
||||
_final(callback: (err?: null | Error) => void): void;
|
||||
setDefaultEncoding(encoding: string): this;
|
||||
cork(): void;
|
||||
uncork(): void;
|
||||
@@ -726,7 +725,7 @@ declare namespace NodeJS {
|
||||
isRaw?: boolean;
|
||||
setRawMode?(mode: boolean): void;
|
||||
_read(size: number): void;
|
||||
_destroy(err: Error | null, callback: Function): void;
|
||||
_destroy(err: Error | null, callback: (err?: null | Error) => void): void;
|
||||
push(chunk: any, encoding?: string): boolean;
|
||||
destroy(error?: Error): void;
|
||||
}
|
||||
|
||||
33
types/node/http.d.ts
vendored
33
types/node/http.d.ts
vendored
@@ -1,8 +1,8 @@
|
||||
declare module "http" {
|
||||
import * as events from "events";
|
||||
import * as net from "net";
|
||||
import * as stream from "stream";
|
||||
import { URL } from "url";
|
||||
import { Socket, Server as NetServer } from "net";
|
||||
|
||||
// incoming headers will never contain number
|
||||
interface IncomingHttpHeaders {
|
||||
@@ -85,7 +85,7 @@ declare module "http" {
|
||||
timeout?: number;
|
||||
setHost?: boolean;
|
||||
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
|
||||
createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: net.Socket) => void) => net.Socket;
|
||||
createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket;
|
||||
}
|
||||
|
||||
interface ServerOptions {
|
||||
@@ -95,7 +95,7 @@ declare module "http" {
|
||||
|
||||
type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
|
||||
|
||||
class Server extends net.Server {
|
||||
class Server extends NetServer {
|
||||
constructor(requestListener?: RequestListener);
|
||||
constructor(options: ServerOptions, requestListener?: RequestListener);
|
||||
|
||||
@@ -120,7 +120,7 @@ declare module "http" {
|
||||
sendDate: boolean;
|
||||
finished: boolean;
|
||||
headersSent: boolean;
|
||||
connection: net.Socket;
|
||||
connection: Socket;
|
||||
|
||||
constructor();
|
||||
|
||||
@@ -142,8 +142,8 @@ declare module "http" {
|
||||
|
||||
constructor(req: IncomingMessage);
|
||||
|
||||
assignSocket(socket: net.Socket): void;
|
||||
detachSocket(socket: net.Socket): void;
|
||||
assignSocket(socket: Socket): void;
|
||||
detachSocket(socket: Socket): void;
|
||||
// https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53
|
||||
// no args in writeContinue callback
|
||||
writeContinue(callback?: () => void): void;
|
||||
@@ -153,27 +153,27 @@ declare module "http" {
|
||||
|
||||
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L77
|
||||
class ClientRequest extends OutgoingMessage {
|
||||
connection: net.Socket;
|
||||
socket: net.Socket;
|
||||
connection: Socket;
|
||||
socket: Socket;
|
||||
aborted: number;
|
||||
|
||||
constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
|
||||
|
||||
readonly path: string;
|
||||
abort(): void;
|
||||
onSocket(socket: net.Socket): void;
|
||||
onSocket(socket: Socket): void;
|
||||
setTimeout(timeout: number, callback?: () => void): this;
|
||||
setNoDelay(noDelay?: boolean): void;
|
||||
setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
|
||||
}
|
||||
|
||||
class IncomingMessage extends stream.Readable {
|
||||
constructor(socket: net.Socket);
|
||||
constructor(socket: Socket);
|
||||
|
||||
httpVersion: string;
|
||||
httpVersionMajor: number;
|
||||
httpVersionMinor: number;
|
||||
connection: net.Socket;
|
||||
connection: Socket;
|
||||
headers: IncomingHttpHeaders;
|
||||
rawHeaders: string[];
|
||||
trailers: { [key: string]: string | undefined };
|
||||
@@ -195,7 +195,7 @@ declare module "http" {
|
||||
* Only valid for response obtained from http.ClientRequest.
|
||||
*/
|
||||
statusMessage?: string;
|
||||
socket: net.Socket;
|
||||
socket: Socket;
|
||||
destroy(error?: Error): void;
|
||||
}
|
||||
|
||||
@@ -226,8 +226,12 @@ declare module "http" {
|
||||
class Agent {
|
||||
maxFreeSockets: number;
|
||||
maxSockets: number;
|
||||
sockets: any;
|
||||
requests: any;
|
||||
readonly sockets: {
|
||||
readonly [key: string]: Socket[];
|
||||
};
|
||||
readonly requests: {
|
||||
readonly [key: string]: IncomingMessage[];
|
||||
};
|
||||
|
||||
constructor(opts?: AgentOptions);
|
||||
|
||||
@@ -249,7 +253,6 @@ declare module "http" {
|
||||
|
||||
function createServer(requestListener?: RequestListener): Server;
|
||||
function createServer(options: ServerOptions, requestListener?: RequestListener): Server;
|
||||
function createClient(port?: number, host?: string): any;
|
||||
|
||||
// although RequestOptions are passed as ClientRequestArgs to ClientRequest directly,
|
||||
// create interface RequestOptions would make the naming more clear to developers
|
||||
|
||||
2
types/node/http2.d.ts
vendored
2
types/node/http2.d.ts
vendored
@@ -558,7 +558,7 @@ declare module "http2" {
|
||||
prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
}
|
||||
|
||||
export class Http2ServerResponse extends events.EventEmitter {
|
||||
export class Http2ServerResponse extends stream.Stream {
|
||||
private constructor();
|
||||
addTrailers(trailers: OutgoingHttpHeaders): void;
|
||||
connection: net.Socket | tls.TLSSocket;
|
||||
|
||||
56
types/node/net.d.ts
vendored
56
types/node/net.d.ts
vendored
@@ -38,22 +38,18 @@ declare module "net" {
|
||||
constructor(options?: SocketConstructorOpts);
|
||||
|
||||
// Extended base methods
|
||||
write(buffer: Buffer): boolean;
|
||||
write(buffer: Buffer, cb?: Function): boolean;
|
||||
write(str: string, cb?: Function): boolean;
|
||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
||||
write(str: string, encoding?: string, fd?: string): boolean;
|
||||
write(data: any, encoding?: string, callback?: Function): void;
|
||||
write(buffer: Buffer | Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
||||
write(str: Buffer | Uint8Array | string, encoding?: string, cb?: (err?: Error) => void): boolean;
|
||||
|
||||
connect(options: SocketConnectOpts, connectionListener?: Function): this;
|
||||
connect(port: number, host: string, connectionListener?: Function): this;
|
||||
connect(port: number, connectionListener?: Function): this;
|
||||
connect(path: string, connectionListener?: Function): this;
|
||||
connect(options: SocketConnectOpts, connectionListener?: () => void): this;
|
||||
connect(port: number, host: string, connectionListener?: () => void): this;
|
||||
connect(port: number, connectionListener?: () => void): this;
|
||||
connect(path: string, connectionListener?: () => void): this;
|
||||
|
||||
setEncoding(encoding?: string): this;
|
||||
pause(): this;
|
||||
resume(): this;
|
||||
setTimeout(timeout: number, callback?: Function): this;
|
||||
setTimeout(timeout: number, callback?: () => void): this;
|
||||
setNoDelay(noDelay?: boolean): this;
|
||||
setKeepAlive(enable?: boolean, initialDelay?: number): this;
|
||||
address(): AddressInfo | string;
|
||||
@@ -72,11 +68,9 @@ declare module "net" {
|
||||
readonly remotePort?: number;
|
||||
|
||||
// Extended base methods
|
||||
end(): void;
|
||||
end(buffer: Buffer, cb?: Function): void;
|
||||
end(str: string, cb?: Function): void;
|
||||
end(str: string, encoding?: string, cb?: Function): void;
|
||||
end(data?: any, encoding?: string): void;
|
||||
end(cb?: () => void): void;
|
||||
end(buffer: Buffer | Uint8Array | string, cb?: () => void): void;
|
||||
end(str: Buffer | Uint8Array | string, encoding?: string, cb?: () => void): void;
|
||||
|
||||
/**
|
||||
* events.EventEmitter
|
||||
@@ -169,15 +163,15 @@ declare module "net" {
|
||||
constructor(connectionListener?: (socket: Socket) => void);
|
||||
constructor(options?: { allowHalfOpen?: boolean, pauseOnConnect?: boolean }, connectionListener?: (socket: Socket) => void);
|
||||
|
||||
listen(port?: number, hostname?: string, backlog?: number, listeningListener?: Function): this;
|
||||
listen(port?: number, hostname?: string, listeningListener?: Function): this;
|
||||
listen(port?: number, backlog?: number, listeningListener?: Function): this;
|
||||
listen(port?: number, listeningListener?: Function): this;
|
||||
listen(path: string, backlog?: number, listeningListener?: Function): this;
|
||||
listen(path: string, listeningListener?: Function): this;
|
||||
listen(options: ListenOptions, listeningListener?: Function): this;
|
||||
listen(handle: any, backlog?: number, listeningListener?: Function): this;
|
||||
listen(handle: any, listeningListener?: Function): this;
|
||||
listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this;
|
||||
listen(port?: number, hostname?: string, listeningListener?: () => void): this;
|
||||
listen(port?: number, backlog?: number, listeningListener?: () => void): this;
|
||||
listen(port?: number, listeningListener?: () => void): this;
|
||||
listen(path: string, backlog?: number, listeningListener?: () => void): this;
|
||||
listen(path: string, listeningListener?: () => void): this;
|
||||
listen(options: ListenOptions, listeningListener?: () => void): this;
|
||||
listen(handle: any, backlog?: number, listeningListener?: () => void): this;
|
||||
listen(handle: any, listeningListener?: () => void): this;
|
||||
close(callback?: (err?: Error) => void): this;
|
||||
address(): AddressInfo | string | null;
|
||||
getConnections(cb: (error: Error | null, count: number) => void): void;
|
||||
@@ -243,12 +237,12 @@ declare module "net" {
|
||||
|
||||
function createServer(connectionListener?: (socket: Socket) => void): Server;
|
||||
function createServer(options?: { allowHalfOpen?: boolean, pauseOnConnect?: boolean }, connectionListener?: (socket: Socket) => void): Server;
|
||||
function connect(options: NetConnectOpts, connectionListener?: Function): Socket;
|
||||
function connect(port: number, host?: string, connectionListener?: Function): Socket;
|
||||
function connect(path: string, connectionListener?: Function): Socket;
|
||||
function createConnection(options: NetConnectOpts, connectionListener?: Function): Socket;
|
||||
function createConnection(port: number, host?: string, connectionListener?: Function): Socket;
|
||||
function createConnection(path: string, connectionListener?: Function): Socket;
|
||||
function connect(options: NetConnectOpts, connectionListener?: () => void): Socket;
|
||||
function connect(port: number, host?: string, connectionListener?: () => void): Socket;
|
||||
function connect(path: string, connectionListener?: () => void): Socket;
|
||||
function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket;
|
||||
function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
|
||||
function createConnection(path: string, connectionListener?: () => void): Socket;
|
||||
function isIP(input: string): number;
|
||||
function isIPv4(input: string): boolean;
|
||||
function isIPv6(input: string): boolean;
|
||||
|
||||
@@ -2,16 +2,10 @@ import assert = require("assert");
|
||||
import * as fs from "fs";
|
||||
import * as events from "events";
|
||||
import events2 = require("events");
|
||||
import * as zlib from "zlib";
|
||||
import * as url from "url";
|
||||
import * as util from "util";
|
||||
import * as tls from "tls";
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
import * as querystring from "querystring";
|
||||
import * as path from "path";
|
||||
import * as cluster from "cluster";
|
||||
import * as os from "os";
|
||||
import * as vm from "vm";
|
||||
import * as console2 from "console";
|
||||
import * as string_decoder from "string_decoder";
|
||||
@@ -23,50 +17,6 @@ import * as inspector from "inspector";
|
||||
import * as trace_events from "trace_events";
|
||||
import Module = require("module");
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
/// Assert Tests : https://nodejs.org/api/assert.html ///
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
|
||||
|
||||
assert.deepStrictEqual({ a: 1 }, { a: 1 }, "uses === comparator");
|
||||
|
||||
assert.doesNotThrow(() => {
|
||||
const b = false;
|
||||
if (b) { throw new Error("a hammer at your face"); }
|
||||
}, () => 1, "What the...*crunch*");
|
||||
|
||||
assert.equal(3, "3", "uses == comparator");
|
||||
|
||||
assert.fail('stuff broke');
|
||||
|
||||
assert.fail('actual', 'expected', 'message');
|
||||
|
||||
assert.fail(1, 2, undefined, '>');
|
||||
|
||||
assert.ifError(0);
|
||||
|
||||
assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses !== comparator");
|
||||
|
||||
assert.notEqual(1, 2, "uses != comparator");
|
||||
|
||||
assert.notStrictEqual(2, "2", "uses === comparator");
|
||||
|
||||
assert.ok(true);
|
||||
assert.ok(1);
|
||||
|
||||
assert.strictEqual(1, 1, "uses === comparator");
|
||||
|
||||
assert.throws(() => { throw new Error("a hammer at your face"); }, Error, "DODGED IT");
|
||||
|
||||
assert.strict.strict.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Events tests : http://nodejs.org/api/events.html
|
||||
////////////////////////////////////////////////////
|
||||
@@ -633,221 +583,6 @@ import Module = require("module");
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Querystring tests : https://nodejs.org/api/querystring.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
interface SampleObject { a: string; }
|
||||
|
||||
{
|
||||
const obj: SampleObject = { a: "" };
|
||||
const sep = '';
|
||||
const eq = '';
|
||||
const options: querystring.StringifyOptions = {};
|
||||
let result: string;
|
||||
|
||||
result = querystring.stringify(obj);
|
||||
result = querystring.stringify(obj, sep);
|
||||
result = querystring.stringify(obj, sep, eq);
|
||||
result = querystring.stringify(obj, sep, eq);
|
||||
result = querystring.stringify(obj, sep, eq, options);
|
||||
}
|
||||
|
||||
{
|
||||
const str = '';
|
||||
const sep = '';
|
||||
const eq = '';
|
||||
const options: querystring.ParseOptions = {};
|
||||
let result: querystring.ParsedUrlQuery;
|
||||
|
||||
result = querystring.parse(str);
|
||||
result = querystring.parse(str, sep);
|
||||
result = querystring.parse(str, sep, eq);
|
||||
result = querystring.parse(str, sep, eq, options);
|
||||
}
|
||||
|
||||
{
|
||||
const str = '';
|
||||
let result: string;
|
||||
|
||||
result = querystring.escape(str);
|
||||
result = querystring.unescape(str);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// path tests : http://nodejs.org/api/path.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
path.normalize('/foo/bar//baz/asdf/quux/..');
|
||||
|
||||
path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');
|
||||
// returns
|
||||
// '/foo/bar/baz/asdf'
|
||||
|
||||
try {
|
||||
path.join('foo', 'bar');
|
||||
} catch (error) { }
|
||||
|
||||
path.resolve('foo/bar', '/tmp/file/', '..', 'a/../subfile');
|
||||
// Is similar to:
|
||||
//
|
||||
// cd foo/bar
|
||||
// cd /tmp/file/
|
||||
// cd ..
|
||||
// cd a/../subfile
|
||||
// pwd
|
||||
|
||||
path.resolve('/foo/bar', './baz');
|
||||
// returns
|
||||
// '/foo/bar/baz'
|
||||
|
||||
path.resolve('/foo/bar', '/tmp/file/');
|
||||
// returns
|
||||
// '/tmp/file'
|
||||
|
||||
path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif');
|
||||
// if currently in /home/myself/node, it returns
|
||||
// '/home/myself/node/wwwroot/static_files/gif/image.gif'
|
||||
|
||||
path.isAbsolute('/foo/bar'); // true
|
||||
path.isAbsolute('/baz/..'); // true
|
||||
path.isAbsolute('qux/'); // false
|
||||
path.isAbsolute('.'); // false
|
||||
|
||||
path.isAbsolute('//server'); // true
|
||||
path.isAbsolute('C:/foo/..'); // true
|
||||
path.isAbsolute('bar\\baz'); // false
|
||||
path.isAbsolute('.'); // false
|
||||
|
||||
path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb');
|
||||
// returns
|
||||
// '..\\..\\impl\\bbb'
|
||||
|
||||
path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb');
|
||||
// returns
|
||||
// '../../impl/bbb'
|
||||
|
||||
path.dirname('/foo/bar/baz/asdf/quux');
|
||||
// returns
|
||||
// '/foo/bar/baz/asdf'
|
||||
|
||||
path.basename('/foo/bar/baz/asdf/quux.html');
|
||||
// returns
|
||||
// 'quux.html'
|
||||
|
||||
path.basename('/foo/bar/baz/asdf/quux.html', '.html');
|
||||
// returns
|
||||
// 'quux'
|
||||
|
||||
path.extname('index.html');
|
||||
// returns
|
||||
// '.html'
|
||||
|
||||
path.extname('index.coffee.md');
|
||||
// returns
|
||||
// '.md'
|
||||
|
||||
path.extname('index.');
|
||||
// returns
|
||||
// '.'
|
||||
|
||||
path.extname('index');
|
||||
// returns
|
||||
// ''
|
||||
|
||||
'foo/bar/baz'.split(path.sep);
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
|
||||
'foo\\bar\\baz'.split(path.sep);
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
|
||||
process.env["PATH"]; // $ExpectType string | undefined
|
||||
|
||||
path.parse('/home/user/dir/file.txt');
|
||||
// returns
|
||||
// {
|
||||
// root : "/",
|
||||
// dir : "/home/user/dir",
|
||||
// base : "file.txt",
|
||||
// ext : ".txt",
|
||||
// name : "file"
|
||||
// }
|
||||
|
||||
path.parse('C:\\path\\dir\\index.html');
|
||||
// returns
|
||||
// {
|
||||
// root : "C:\",
|
||||
// dir : "C:\path\dir",
|
||||
// base : "index.html",
|
||||
// ext : ".html",
|
||||
// name : "index"
|
||||
// }
|
||||
|
||||
path.format({
|
||||
root: "/",
|
||||
dir: "/home/user/dir",
|
||||
base: "file.txt",
|
||||
ext: ".txt",
|
||||
name: "file"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
|
||||
path.format({
|
||||
root: "/",
|
||||
dir: "/home/user/dir",
|
||||
ext: ".txt",
|
||||
name: "file"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
|
||||
path.format({
|
||||
dir: "/home/user/dir",
|
||||
base: "file.txt"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
|
||||
path.posix.format({
|
||||
root: "/",
|
||||
dir: "/home/user/dir",
|
||||
base: "file.txt",
|
||||
ext: ".txt",
|
||||
name: "file"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
|
||||
path.posix.format({
|
||||
dir: "/home/user/dir",
|
||||
base: "file.txt"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
|
||||
path.win32.format({
|
||||
root: "C:\\",
|
||||
dir: "C:\\home\\user\\dir",
|
||||
ext: ".txt",
|
||||
name: "file"
|
||||
});
|
||||
// returns
|
||||
// 'C:\home\user\dir\file.txt'
|
||||
|
||||
path.win32.format({
|
||||
dir: "C:\\home\\user\\dir",
|
||||
base: "file.txt"
|
||||
});
|
||||
// returns
|
||||
// 'C:\home\user\dir\file.txt'
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// string_decoder tests : https://nodejs.org/api/string_decoder.html
|
||||
////////////////////////////////////////////////////
|
||||
@@ -863,200 +598,6 @@ import Module = require("module");
|
||||
const end2: string = decoder1.end(new Buffer('test'));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/// cluster tests: https://nodejs.org/api/cluster.html ///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
cluster.fork();
|
||||
Object.keys(cluster.workers).forEach(key => {
|
||||
const worker = cluster.workers[key];
|
||||
if (worker && worker.isDead()) {
|
||||
console.log('worker %d is dead', worker.process.pid);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// os tests : https://nodejs.org/api/os.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
let result: string;
|
||||
|
||||
result = os.tmpdir();
|
||||
result = os.homedir();
|
||||
result = os.endianness();
|
||||
result = os.hostname();
|
||||
result = os.type();
|
||||
result = os.arch();
|
||||
result = os.release();
|
||||
result = os.EOL;
|
||||
}
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = os.uptime();
|
||||
result = os.totalmem();
|
||||
result = os.freemem();
|
||||
}
|
||||
|
||||
{
|
||||
let result: number[];
|
||||
|
||||
result = os.loadavg();
|
||||
}
|
||||
|
||||
{
|
||||
let result: os.CpuInfo[];
|
||||
|
||||
result = os.cpus();
|
||||
}
|
||||
|
||||
{
|
||||
let result: { [index: string]: os.NetworkInterfaceInfo[] };
|
||||
|
||||
result = os.networkInterfaces();
|
||||
}
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = os.constants.signals.SIGHUP;
|
||||
result = os.constants.signals.SIGINT;
|
||||
result = os.constants.signals.SIGQUIT;
|
||||
result = os.constants.signals.SIGILL;
|
||||
result = os.constants.signals.SIGTRAP;
|
||||
result = os.constants.signals.SIGABRT;
|
||||
result = os.constants.signals.SIGIOT;
|
||||
result = os.constants.signals.SIGBUS;
|
||||
result = os.constants.signals.SIGFPE;
|
||||
result = os.constants.signals.SIGKILL;
|
||||
result = os.constants.signals.SIGUSR1;
|
||||
result = os.constants.signals.SIGSEGV;
|
||||
result = os.constants.signals.SIGUSR2;
|
||||
result = os.constants.signals.SIGPIPE;
|
||||
result = os.constants.signals.SIGALRM;
|
||||
result = os.constants.signals.SIGTERM;
|
||||
result = os.constants.signals.SIGCHLD;
|
||||
result = os.constants.signals.SIGSTKFLT;
|
||||
result = os.constants.signals.SIGCONT;
|
||||
result = os.constants.signals.SIGSTOP;
|
||||
result = os.constants.signals.SIGTSTP;
|
||||
result = os.constants.signals.SIGTTIN;
|
||||
result = os.constants.signals.SIGTTOU;
|
||||
result = os.constants.signals.SIGURG;
|
||||
result = os.constants.signals.SIGXCPU;
|
||||
result = os.constants.signals.SIGXFSZ;
|
||||
result = os.constants.signals.SIGVTALRM;
|
||||
result = os.constants.signals.SIGPROF;
|
||||
result = os.constants.signals.SIGWINCH;
|
||||
result = os.constants.signals.SIGIO;
|
||||
result = os.constants.signals.SIGPOLL;
|
||||
result = os.constants.signals.SIGPWR;
|
||||
result = os.constants.signals.SIGSYS;
|
||||
result = os.constants.signals.SIGUNUSED;
|
||||
}
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = os.constants.errno.E2BIG;
|
||||
result = os.constants.errno.EACCES;
|
||||
result = os.constants.errno.EADDRINUSE;
|
||||
result = os.constants.errno.EADDRNOTAVAIL;
|
||||
result = os.constants.errno.EAFNOSUPPORT;
|
||||
result = os.constants.errno.EAGAIN;
|
||||
result = os.constants.errno.EALREADY;
|
||||
result = os.constants.errno.EBADF;
|
||||
result = os.constants.errno.EBADMSG;
|
||||
result = os.constants.errno.EBUSY;
|
||||
result = os.constants.errno.ECANCELED;
|
||||
result = os.constants.errno.ECHILD;
|
||||
result = os.constants.errno.ECONNABORTED;
|
||||
result = os.constants.errno.ECONNREFUSED;
|
||||
result = os.constants.errno.ECONNRESET;
|
||||
result = os.constants.errno.EDEADLK;
|
||||
result = os.constants.errno.EDESTADDRREQ;
|
||||
result = os.constants.errno.EDOM;
|
||||
result = os.constants.errno.EDQUOT;
|
||||
result = os.constants.errno.EEXIST;
|
||||
result = os.constants.errno.EFAULT;
|
||||
result = os.constants.errno.EFBIG;
|
||||
result = os.constants.errno.EHOSTUNREACH;
|
||||
result = os.constants.errno.EIDRM;
|
||||
result = os.constants.errno.EILSEQ;
|
||||
result = os.constants.errno.EINPROGRESS;
|
||||
result = os.constants.errno.EINTR;
|
||||
result = os.constants.errno.EINVAL;
|
||||
result = os.constants.errno.EIO;
|
||||
result = os.constants.errno.EISCONN;
|
||||
result = os.constants.errno.EISDIR;
|
||||
result = os.constants.errno.ELOOP;
|
||||
result = os.constants.errno.EMFILE;
|
||||
result = os.constants.errno.EMLINK;
|
||||
result = os.constants.errno.EMSGSIZE;
|
||||
result = os.constants.errno.EMULTIHOP;
|
||||
result = os.constants.errno.ENAMETOOLONG;
|
||||
result = os.constants.errno.ENETDOWN;
|
||||
result = os.constants.errno.ENETRESET;
|
||||
result = os.constants.errno.ENETUNREACH;
|
||||
result = os.constants.errno.ENFILE;
|
||||
result = os.constants.errno.ENOBUFS;
|
||||
result = os.constants.errno.ENODATA;
|
||||
result = os.constants.errno.ENODEV;
|
||||
result = os.constants.errno.ENOENT;
|
||||
result = os.constants.errno.ENOEXEC;
|
||||
result = os.constants.errno.ENOLCK;
|
||||
result = os.constants.errno.ENOLINK;
|
||||
result = os.constants.errno.ENOMEM;
|
||||
result = os.constants.errno.ENOMSG;
|
||||
result = os.constants.errno.ENOPROTOOPT;
|
||||
result = os.constants.errno.ENOSPC;
|
||||
result = os.constants.errno.ENOSR;
|
||||
result = os.constants.errno.ENOSTR;
|
||||
result = os.constants.errno.ENOSYS;
|
||||
result = os.constants.errno.ENOTCONN;
|
||||
result = os.constants.errno.ENOTDIR;
|
||||
result = os.constants.errno.ENOTEMPTY;
|
||||
result = os.constants.errno.ENOTSOCK;
|
||||
result = os.constants.errno.ENOTSUP;
|
||||
result = os.constants.errno.ENOTTY;
|
||||
result = os.constants.errno.ENXIO;
|
||||
result = os.constants.errno.EOPNOTSUPP;
|
||||
result = os.constants.errno.EOVERFLOW;
|
||||
result = os.constants.errno.EPERM;
|
||||
result = os.constants.errno.EPIPE;
|
||||
result = os.constants.errno.EPROTO;
|
||||
result = os.constants.errno.EPROTONOSUPPORT;
|
||||
result = os.constants.errno.EPROTOTYPE;
|
||||
result = os.constants.errno.ERANGE;
|
||||
result = os.constants.errno.EROFS;
|
||||
result = os.constants.errno.ESPIPE;
|
||||
result = os.constants.errno.ESRCH;
|
||||
result = os.constants.errno.ESTALE;
|
||||
result = os.constants.errno.ETIME;
|
||||
result = os.constants.errno.ETIMEDOUT;
|
||||
result = os.constants.errno.ETXTBSY;
|
||||
result = os.constants.errno.EWOULDBLOCK;
|
||||
result = os.constants.errno.EXDEV;
|
||||
}
|
||||
|
||||
{
|
||||
const prio = os.getPriority();
|
||||
os.setPriority(prio + 1);
|
||||
|
||||
const prio2 = os.getPriority(1);
|
||||
os.setPriority(2, prio + 1);
|
||||
|
||||
os.setPriority(os.constants.priority.PRIORITY_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// vm tests : https://nodejs.org/api/vm.html
|
||||
////////////////////////////////////////////////////
|
||||
@@ -1655,27 +1196,6 @@ import * as constants from 'constants';
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// zlib tests : http://nodejs.org/api/zlib.html ///
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const gzipped = zlib.gzipSync('test');
|
||||
const unzipped = zlib.gunzipSync(gzipped.toString());
|
||||
}
|
||||
|
||||
{
|
||||
const deflate = zlib.deflateSync('test');
|
||||
const inflate = zlib.inflateSync(deflate.toString());
|
||||
}
|
||||
|
||||
{
|
||||
const gzip = zlib.createGzip();
|
||||
const written: number = gzip.bytesWritten;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Inspector Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
11
types/node/os.d.ts
vendored
11
types/node/os.d.ts
vendored
@@ -28,6 +28,14 @@ declare module "os" {
|
||||
scopeid: number;
|
||||
}
|
||||
|
||||
interface UserInfo<T> {
|
||||
username: T;
|
||||
uid: number;
|
||||
gid: number;
|
||||
shell: T;
|
||||
homedir: T;
|
||||
}
|
||||
|
||||
type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6;
|
||||
|
||||
function hostname(): string;
|
||||
@@ -40,7 +48,8 @@ declare module "os" {
|
||||
function release(): string;
|
||||
function networkInterfaces(): { [index: string]: NetworkInterfaceInfo[] };
|
||||
function homedir(): string;
|
||||
function userInfo(options?: { encoding: string }): { username: string, uid: number, gid: number, shell: any, homedir: string };
|
||||
function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>;
|
||||
function userInfo(options?: { encoding: string }): UserInfo<string>;
|
||||
const constants: {
|
||||
UV_UDP_REUSEADDR: number;
|
||||
signals: {
|
||||
|
||||
8
types/node/path.d.ts
vendored
8
types/node/path.d.ts
vendored
@@ -129,8 +129,8 @@ declare module "path" {
|
||||
|
||||
namespace posix {
|
||||
function normalize(p: string): string;
|
||||
function join(...paths: any[]): string;
|
||||
function resolve(...pathSegments: any[]): string;
|
||||
function join(...paths: string[]): string;
|
||||
function resolve(...pathSegments: string[]): string;
|
||||
function isAbsolute(p: string): boolean;
|
||||
function relative(from: string, to: string): string;
|
||||
function dirname(p: string): string;
|
||||
@@ -144,8 +144,8 @@ declare module "path" {
|
||||
|
||||
namespace win32 {
|
||||
function normalize(p: string): string;
|
||||
function join(...paths: any[]): string;
|
||||
function resolve(...pathSegments: any[]): string;
|
||||
function join(...paths: string[]): string;
|
||||
function resolve(...pathSegments: string[]): string;
|
||||
function isAbsolute(p: string): boolean;
|
||||
function relative(from: string, to: string): string;
|
||||
function dirname(p: string): string;
|
||||
|
||||
2
types/node/punycode.d.ts
vendored
2
types/node/punycode.d.ts
vendored
@@ -8,5 +8,5 @@ declare module "punycode" {
|
||||
decode(string: string): number[];
|
||||
encode(codePoints: number[]): string;
|
||||
}
|
||||
const version: any;
|
||||
const version: string;
|
||||
}
|
||||
|
||||
4
types/node/querystring.d.ts
vendored
4
types/node/querystring.d.ts
vendored
@@ -1,11 +1,11 @@
|
||||
declare module "querystring" {
|
||||
interface StringifyOptions {
|
||||
encodeURIComponent?: Function;
|
||||
encodeURIComponent?: (str: string) => string;
|
||||
}
|
||||
|
||||
interface ParseOptions {
|
||||
maxKeys?: number;
|
||||
decodeURIComponent?: Function;
|
||||
decodeURIComponent?: (str: string) => string;
|
||||
}
|
||||
|
||||
interface ParsedUrlQuery { [key: string]: string | string[]; }
|
||||
|
||||
2
types/node/readline.d.ts
vendored
2
types/node/readline.d.ts
vendored
@@ -110,7 +110,7 @@ declare module "readline" {
|
||||
type ReadLine = Interface; // type forwarded for backwards compatiblity
|
||||
|
||||
type Completer = (line: string) => CompleterResult;
|
||||
type AsyncCompleter = (line: string, callback: (err: any, result: CompleterResult) => void) => any;
|
||||
type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => any;
|
||||
|
||||
type CompleterResult = [string[], string];
|
||||
|
||||
|
||||
6
types/node/stream.d.ts
vendored
6
types/node/stream.d.ts
vendored
@@ -31,7 +31,7 @@ declare module "stream" {
|
||||
unshift(chunk: any): void;
|
||||
wrap(oldStream: NodeJS.ReadableStream): this;
|
||||
push(chunk: any, encoding?: string): boolean;
|
||||
_destroy(error: Error | null, callback: (error: Error | null) => void): void;
|
||||
_destroy(error: Error | null, callback: (error?: Error | null) => void): void;
|
||||
destroy(error?: Error): void;
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ declare module "stream" {
|
||||
constructor(opts?: WritableOptions);
|
||||
_write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void;
|
||||
_writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void;
|
||||
_destroy(error: Error | null, callback: (error: Error | null) => void): void;
|
||||
_destroy(error: Error | null, callback: (error?: Error | null) => void): void;
|
||||
_final(callback: (error?: Error | null) => void): void;
|
||||
write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
|
||||
write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean;
|
||||
@@ -212,8 +212,8 @@ declare module "stream" {
|
||||
_writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void;
|
||||
_destroy(error: Error | null, callback: (error: Error | null) => void): void;
|
||||
_final(callback: (error?: Error | null) => void): void;
|
||||
write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
|
||||
write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean;
|
||||
write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
|
||||
setDefaultEncoding(encoding: string): this;
|
||||
end(cb?: () => void): void;
|
||||
end(chunk: any, cb?: () => void): void;
|
||||
|
||||
43
types/node/test/assert.ts
Normal file
43
types/node/test/assert.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import * as assert from 'assert';
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
|
||||
|
||||
assert.deepStrictEqual({ a: 1 }, { a: 1 }, "uses === comparator");
|
||||
|
||||
assert.doesNotThrow(() => {
|
||||
const b = false;
|
||||
if (b) { throw new Error("a hammer at your face"); }
|
||||
}, () => 1, "What the...*crunch*");
|
||||
|
||||
assert.equal(3, "3", "uses == comparator");
|
||||
|
||||
assert.fail('stuff broke');
|
||||
|
||||
assert.fail('actual', 'expected', 'message');
|
||||
|
||||
assert.fail(1, 2, undefined, '>');
|
||||
|
||||
assert.ifError(0);
|
||||
|
||||
assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses !== comparator");
|
||||
|
||||
assert.notEqual(1, 2, "uses != comparator");
|
||||
|
||||
assert.notStrictEqual(2, "2", "uses === comparator");
|
||||
|
||||
assert.ok(true);
|
||||
assert.ok(1);
|
||||
|
||||
assert.strictEqual(1, 1, "uses === comparator");
|
||||
|
||||
assert.throws(() => { throw new Error("a hammer at your face"); }, Error, "DODGED IT");
|
||||
|
||||
assert.rejects(async () => 1);
|
||||
assert.rejects(Promise.resolve(1));
|
||||
|
||||
assert.doesNotReject(async () => 1);
|
||||
assert.doesNotReject(Promise.resolve(1));
|
||||
|
||||
assert.strict.strict.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
||||
11
types/node/test/cluster.ts
Normal file
11
types/node/test/cluster.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as cluster from 'cluster';
|
||||
|
||||
cluster.fork();
|
||||
Object.keys(cluster.workers).forEach(key => {
|
||||
const worker = cluster.workers[key];
|
||||
if (worker && worker.isDead()) {
|
||||
console.log('worker %d is dead', worker.process.pid);
|
||||
}
|
||||
});
|
||||
|
||||
cluster.on('setup', (settings: cluster.ClusterSettings) => {});
|
||||
@@ -135,7 +135,7 @@ import { promisify } from 'util';
|
||||
decipher.setAAD(aad, {
|
||||
plaintextLength: ciphertext.length
|
||||
});
|
||||
const receivedPlaintext: string = decipher.update(ciphertext, null, 'utf8');
|
||||
const receivedPlaintext: string = decipher.update(ciphertext, undefined, 'utf8');
|
||||
decipher.final();
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ import { promisify } from 'util';
|
||||
decipher.setAAD(aad, {
|
||||
plaintextLength: ciphertext.length
|
||||
});
|
||||
const receivedPlaintext: string = decipher.update(ciphertext, null, 'utf8');
|
||||
const receivedPlaintext: string = decipher.update(ciphertext, undefined, 'utf8');
|
||||
decipher.final();
|
||||
}
|
||||
|
||||
|
||||
@@ -326,8 +326,6 @@ import { URL } from 'url';
|
||||
response.end('', 'utf8', () => {});
|
||||
response.end(Buffer.from([]));
|
||||
response.end(Buffer.from([]), () => {});
|
||||
response.end(Buffer.from([]), 'utf8');
|
||||
response.end(Buffer.from([]), 'utf8', () => {});
|
||||
|
||||
request.on('aborted', (hadError: boolean, code: number) => {});
|
||||
request.on('close', () => {});
|
||||
|
||||
177
types/node/test/os.ts
Normal file
177
types/node/test/os.ts
Normal file
@@ -0,0 +1,177 @@
|
||||
import * as os from 'os';
|
||||
{
|
||||
let result: string;
|
||||
|
||||
result = os.tmpdir();
|
||||
result = os.homedir();
|
||||
result = os.endianness();
|
||||
result = os.hostname();
|
||||
result = os.type();
|
||||
result = os.arch();
|
||||
result = os.release();
|
||||
result = os.EOL;
|
||||
}
|
||||
|
||||
{
|
||||
const a: os.UserInfo<string> = os.userInfo();
|
||||
const b: os.UserInfo<Buffer> = os.userInfo({ encoding: 'buffer' });
|
||||
}
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = os.uptime();
|
||||
result = os.totalmem();
|
||||
result = os.freemem();
|
||||
}
|
||||
|
||||
{
|
||||
let result: number[];
|
||||
|
||||
result = os.loadavg();
|
||||
}
|
||||
|
||||
{
|
||||
let result: os.CpuInfo[];
|
||||
|
||||
result = os.cpus();
|
||||
}
|
||||
|
||||
{
|
||||
let result: { [index: string]: os.NetworkInterfaceInfo[] };
|
||||
|
||||
result = os.networkInterfaces();
|
||||
}
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = os.constants.signals.SIGHUP;
|
||||
result = os.constants.signals.SIGINT;
|
||||
result = os.constants.signals.SIGQUIT;
|
||||
result = os.constants.signals.SIGILL;
|
||||
result = os.constants.signals.SIGTRAP;
|
||||
result = os.constants.signals.SIGABRT;
|
||||
result = os.constants.signals.SIGIOT;
|
||||
result = os.constants.signals.SIGBUS;
|
||||
result = os.constants.signals.SIGFPE;
|
||||
result = os.constants.signals.SIGKILL;
|
||||
result = os.constants.signals.SIGUSR1;
|
||||
result = os.constants.signals.SIGSEGV;
|
||||
result = os.constants.signals.SIGUSR2;
|
||||
result = os.constants.signals.SIGPIPE;
|
||||
result = os.constants.signals.SIGALRM;
|
||||
result = os.constants.signals.SIGTERM;
|
||||
result = os.constants.signals.SIGCHLD;
|
||||
result = os.constants.signals.SIGSTKFLT;
|
||||
result = os.constants.signals.SIGCONT;
|
||||
result = os.constants.signals.SIGSTOP;
|
||||
result = os.constants.signals.SIGTSTP;
|
||||
result = os.constants.signals.SIGTTIN;
|
||||
result = os.constants.signals.SIGTTOU;
|
||||
result = os.constants.signals.SIGURG;
|
||||
result = os.constants.signals.SIGXCPU;
|
||||
result = os.constants.signals.SIGXFSZ;
|
||||
result = os.constants.signals.SIGVTALRM;
|
||||
result = os.constants.signals.SIGPROF;
|
||||
result = os.constants.signals.SIGWINCH;
|
||||
result = os.constants.signals.SIGIO;
|
||||
result = os.constants.signals.SIGPOLL;
|
||||
result = os.constants.signals.SIGPWR;
|
||||
result = os.constants.signals.SIGSYS;
|
||||
result = os.constants.signals.SIGUNUSED;
|
||||
}
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = os.constants.errno.E2BIG;
|
||||
result = os.constants.errno.EACCES;
|
||||
result = os.constants.errno.EADDRINUSE;
|
||||
result = os.constants.errno.EADDRNOTAVAIL;
|
||||
result = os.constants.errno.EAFNOSUPPORT;
|
||||
result = os.constants.errno.EAGAIN;
|
||||
result = os.constants.errno.EALREADY;
|
||||
result = os.constants.errno.EBADF;
|
||||
result = os.constants.errno.EBADMSG;
|
||||
result = os.constants.errno.EBUSY;
|
||||
result = os.constants.errno.ECANCELED;
|
||||
result = os.constants.errno.ECHILD;
|
||||
result = os.constants.errno.ECONNABORTED;
|
||||
result = os.constants.errno.ECONNREFUSED;
|
||||
result = os.constants.errno.ECONNRESET;
|
||||
result = os.constants.errno.EDEADLK;
|
||||
result = os.constants.errno.EDESTADDRREQ;
|
||||
result = os.constants.errno.EDOM;
|
||||
result = os.constants.errno.EDQUOT;
|
||||
result = os.constants.errno.EEXIST;
|
||||
result = os.constants.errno.EFAULT;
|
||||
result = os.constants.errno.EFBIG;
|
||||
result = os.constants.errno.EHOSTUNREACH;
|
||||
result = os.constants.errno.EIDRM;
|
||||
result = os.constants.errno.EILSEQ;
|
||||
result = os.constants.errno.EINPROGRESS;
|
||||
result = os.constants.errno.EINTR;
|
||||
result = os.constants.errno.EINVAL;
|
||||
result = os.constants.errno.EIO;
|
||||
result = os.constants.errno.EISCONN;
|
||||
result = os.constants.errno.EISDIR;
|
||||
result = os.constants.errno.ELOOP;
|
||||
result = os.constants.errno.EMFILE;
|
||||
result = os.constants.errno.EMLINK;
|
||||
result = os.constants.errno.EMSGSIZE;
|
||||
result = os.constants.errno.EMULTIHOP;
|
||||
result = os.constants.errno.ENAMETOOLONG;
|
||||
result = os.constants.errno.ENETDOWN;
|
||||
result = os.constants.errno.ENETRESET;
|
||||
result = os.constants.errno.ENETUNREACH;
|
||||
result = os.constants.errno.ENFILE;
|
||||
result = os.constants.errno.ENOBUFS;
|
||||
result = os.constants.errno.ENODATA;
|
||||
result = os.constants.errno.ENODEV;
|
||||
result = os.constants.errno.ENOENT;
|
||||
result = os.constants.errno.ENOEXEC;
|
||||
result = os.constants.errno.ENOLCK;
|
||||
result = os.constants.errno.ENOLINK;
|
||||
result = os.constants.errno.ENOMEM;
|
||||
result = os.constants.errno.ENOMSG;
|
||||
result = os.constants.errno.ENOPROTOOPT;
|
||||
result = os.constants.errno.ENOSPC;
|
||||
result = os.constants.errno.ENOSR;
|
||||
result = os.constants.errno.ENOSTR;
|
||||
result = os.constants.errno.ENOSYS;
|
||||
result = os.constants.errno.ENOTCONN;
|
||||
result = os.constants.errno.ENOTDIR;
|
||||
result = os.constants.errno.ENOTEMPTY;
|
||||
result = os.constants.errno.ENOTSOCK;
|
||||
result = os.constants.errno.ENOTSUP;
|
||||
result = os.constants.errno.ENOTTY;
|
||||
result = os.constants.errno.ENXIO;
|
||||
result = os.constants.errno.EOPNOTSUPP;
|
||||
result = os.constants.errno.EOVERFLOW;
|
||||
result = os.constants.errno.EPERM;
|
||||
result = os.constants.errno.EPIPE;
|
||||
result = os.constants.errno.EPROTO;
|
||||
result = os.constants.errno.EPROTONOSUPPORT;
|
||||
result = os.constants.errno.EPROTOTYPE;
|
||||
result = os.constants.errno.ERANGE;
|
||||
result = os.constants.errno.EROFS;
|
||||
result = os.constants.errno.ESPIPE;
|
||||
result = os.constants.errno.ESRCH;
|
||||
result = os.constants.errno.ESTALE;
|
||||
result = os.constants.errno.ETIME;
|
||||
result = os.constants.errno.ETIMEDOUT;
|
||||
result = os.constants.errno.ETXTBSY;
|
||||
result = os.constants.errno.EWOULDBLOCK;
|
||||
result = os.constants.errno.EXDEV;
|
||||
}
|
||||
|
||||
{
|
||||
const prio = os.getPriority();
|
||||
os.setPriority(prio + 1);
|
||||
|
||||
const prio2 = os.getPriority(1);
|
||||
os.setPriority(2, prio + 1);
|
||||
|
||||
os.setPriority(os.constants.priority.PRIORITY_LOW);
|
||||
}
|
||||
167
types/node/test/path.ts
Normal file
167
types/node/test/path.ts
Normal file
@@ -0,0 +1,167 @@
|
||||
import * as path from 'path';
|
||||
|
||||
path.normalize('/foo/bar//baz/asdf/quux/..');
|
||||
|
||||
path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');
|
||||
// returns
|
||||
// '/foo/bar/baz/asdf'
|
||||
|
||||
try {
|
||||
path.join('foo', 'bar');
|
||||
} catch (error) { }
|
||||
|
||||
path.resolve('foo/bar', '/tmp/file/', '..', 'a/../subfile');
|
||||
// Is similar to:
|
||||
//
|
||||
// cd foo/bar
|
||||
// cd /tmp/file/
|
||||
// cd ..
|
||||
// cd a/../subfile
|
||||
// pwd
|
||||
|
||||
path.resolve('/foo/bar', './baz');
|
||||
// returns
|
||||
// '/foo/bar/baz'
|
||||
|
||||
path.resolve('/foo/bar', '/tmp/file/');
|
||||
// returns
|
||||
// '/tmp/file'
|
||||
|
||||
path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif');
|
||||
// if currently in /home/myself/node, it returns
|
||||
// '/home/myself/node/wwwroot/static_files/gif/image.gif'
|
||||
|
||||
path.isAbsolute('/foo/bar'); // true
|
||||
path.isAbsolute('/baz/..'); // true
|
||||
path.isAbsolute('qux/'); // false
|
||||
path.isAbsolute('.'); // false
|
||||
|
||||
path.isAbsolute('//server'); // true
|
||||
path.isAbsolute('C:/foo/..'); // true
|
||||
path.isAbsolute('bar\\baz'); // false
|
||||
path.isAbsolute('.'); // false
|
||||
|
||||
path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb');
|
||||
// returns
|
||||
// '..\\..\\impl\\bbb'
|
||||
|
||||
path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb');
|
||||
// returns
|
||||
// '../../impl/bbb'
|
||||
|
||||
path.dirname('/foo/bar/baz/asdf/quux');
|
||||
// returns
|
||||
// '/foo/bar/baz/asdf'
|
||||
|
||||
path.basename('/foo/bar/baz/asdf/quux.html');
|
||||
// returns
|
||||
// 'quux.html'
|
||||
|
||||
path.basename('/foo/bar/baz/asdf/quux.html', '.html');
|
||||
// returns
|
||||
// 'quux'
|
||||
|
||||
path.extname('index.html');
|
||||
// returns
|
||||
// '.html'
|
||||
|
||||
path.extname('index.coffee.md');
|
||||
// returns
|
||||
// '.md'
|
||||
|
||||
path.extname('index.');
|
||||
// returns
|
||||
// '.'
|
||||
|
||||
path.extname('index');
|
||||
// returns
|
||||
// ''
|
||||
|
||||
'foo/bar/baz'.split(path.sep);
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
|
||||
'foo\\bar\\baz'.split(path.sep);
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
|
||||
process.env["PATH"]; // $ExpectType string | undefined
|
||||
|
||||
path.parse('/home/user/dir/file.txt');
|
||||
// returns
|
||||
// {
|
||||
// root : "/",
|
||||
// dir : "/home/user/dir",
|
||||
// base : "file.txt",
|
||||
// ext : ".txt",
|
||||
// name : "file"
|
||||
// }
|
||||
|
||||
path.parse('C:\\path\\dir\\index.html');
|
||||
// returns
|
||||
// {
|
||||
// root : "C:\",
|
||||
// dir : "C:\path\dir",
|
||||
// base : "index.html",
|
||||
// ext : ".html",
|
||||
// name : "index"
|
||||
// }
|
||||
|
||||
path.format({
|
||||
root: "/",
|
||||
dir: "/home/user/dir",
|
||||
base: "file.txt",
|
||||
ext: ".txt",
|
||||
name: "file"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
|
||||
path.format({
|
||||
root: "/",
|
||||
dir: "/home/user/dir",
|
||||
ext: ".txt",
|
||||
name: "file"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
|
||||
path.format({
|
||||
dir: "/home/user/dir",
|
||||
base: "file.txt"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
|
||||
path.posix.format({
|
||||
root: "/",
|
||||
dir: "/home/user/dir",
|
||||
base: "file.txt",
|
||||
ext: ".txt",
|
||||
name: "file"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
|
||||
path.posix.format({
|
||||
dir: "/home/user/dir",
|
||||
base: "file.txt"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
|
||||
path.win32.format({
|
||||
root: "C:\\",
|
||||
dir: "C:\\home\\user\\dir",
|
||||
ext: ".txt",
|
||||
name: "file"
|
||||
});
|
||||
// returns
|
||||
// 'C:\home\user\dir\file.txt'
|
||||
|
||||
path.win32.format({
|
||||
dir: "C:\\home\\user\\dir",
|
||||
base: "file.txt"
|
||||
});
|
||||
// returns
|
||||
// 'C:\home\user\dir\file.txt'
|
||||
42
types/node/test/querystring.ts
Normal file
42
types/node/test/querystring.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import * as querystring from 'querystring';
|
||||
|
||||
interface SampleObject { a: string; }
|
||||
|
||||
{
|
||||
const obj: SampleObject = { a: "" };
|
||||
const sep = '';
|
||||
const eq = '';
|
||||
const options: querystring.StringifyOptions = {
|
||||
encodeURIComponent: (d: string) => d,
|
||||
};
|
||||
let result: string;
|
||||
|
||||
result = querystring.stringify(obj);
|
||||
result = querystring.stringify(obj, sep);
|
||||
result = querystring.stringify(obj, sep, eq);
|
||||
result = querystring.stringify(obj, sep, eq);
|
||||
result = querystring.stringify(obj, sep, eq, options);
|
||||
}
|
||||
|
||||
{
|
||||
const str = '';
|
||||
const sep = '';
|
||||
const eq = '';
|
||||
const options: querystring.ParseOptions = {
|
||||
decodeURIComponent: (d: string) => d,
|
||||
};
|
||||
let result: querystring.ParsedUrlQuery;
|
||||
|
||||
result = querystring.parse(str);
|
||||
result = querystring.parse(str, sep);
|
||||
result = querystring.parse(str, sep, eq);
|
||||
result = querystring.parse(str, sep, eq, options);
|
||||
}
|
||||
|
||||
{
|
||||
const str = '';
|
||||
let result: string;
|
||||
|
||||
result = querystring.escape(str);
|
||||
result = querystring.unescape(str);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ const rl: readline.ReadLine = readline.createInterface(new stream.Readable());
|
||||
|
||||
_rl = _rl.addListener("close", () => { });
|
||||
_rl = _rl.addListener("line", (input) => {
|
||||
const _input: any = input;
|
||||
const _input: string = input;
|
||||
});
|
||||
_rl = _rl.addListener("pause", () => { });
|
||||
_rl = _rl.addListener("resume", () => { });
|
||||
|
||||
@@ -21,7 +21,7 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
let _server = createServer({});
|
||||
let _boolean: boolean;
|
||||
const _func1 = (err: Error, resp: Buffer) => { };
|
||||
const _func2 = (err: Error, sessionData: any) => { };
|
||||
const _func2 = (err: Error, sessionData: Buffer) => { };
|
||||
/**
|
||||
* events.EventEmitter
|
||||
* 1. tlsClientError
|
||||
@@ -36,8 +36,8 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
const _tlsSocket: TLSSocket = tlsSocket;
|
||||
});
|
||||
_server = _server.addListener("newSession", (sessionId, sessionData, callback) => {
|
||||
const _sessionId: any = sessionId;
|
||||
const _sessionData: any = sessionData;
|
||||
const _sessionId: Buffer = sessionId;
|
||||
const _sessionData: Buffer = sessionData;
|
||||
const _func1 = callback;
|
||||
});
|
||||
_server = _server.addListener("OCSPRequest", (certificate, issuer, callback) => {
|
||||
@@ -46,7 +46,7 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
const _callback: Function = callback;
|
||||
});
|
||||
_server = _server.addListener("resumeSession", (sessionId, callback) => {
|
||||
const _sessionId: any = sessionId;
|
||||
const _sessionId: Buffer = sessionId;
|
||||
const _func2 = callback;
|
||||
});
|
||||
_server = _server.addListener("secureConnection", (tlsSocket) => {
|
||||
@@ -55,7 +55,7 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
|
||||
const _err: Error = new Error();
|
||||
const _tlsSocket: TLSSocket = connect(1);
|
||||
const _any: any = 1;
|
||||
const _any: Buffer = Buffer.from('asd');
|
||||
const _func: Function = () => {};
|
||||
const _buffer: Buffer = Buffer.from('a');
|
||||
_boolean = _server.emit("tlsClientError", _err, _tlsSocket);
|
||||
@@ -69,8 +69,8 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
const _tlsSocket: TLSSocket = tlsSocket;
|
||||
});
|
||||
_server = _server.on("newSession", (sessionId, sessionData, callback) => {
|
||||
const _sessionId: any = sessionId;
|
||||
const _sessionData: any = sessionData;
|
||||
const _sessionId: Buffer = sessionId;
|
||||
const _sessionData: Buffer = sessionData;
|
||||
const _func1 = callback;
|
||||
});
|
||||
_server = _server.on("OCSPRequest", (certificate, issuer, callback) => {
|
||||
@@ -79,7 +79,7 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
const _callback: Function = callback;
|
||||
});
|
||||
_server = _server.on("resumeSession", (sessionId, callback) => {
|
||||
const _sessionId: any = sessionId;
|
||||
const _sessionId: Buffer = sessionId;
|
||||
const _func2 = callback;
|
||||
});
|
||||
_server = _server.on("secureConnection", (tlsSocket) => {
|
||||
@@ -91,8 +91,8 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
const _tlsSocket: TLSSocket = tlsSocket;
|
||||
});
|
||||
_server = _server.once("newSession", (sessionId, sessionData, callback) => {
|
||||
const _sessionId: any = sessionId;
|
||||
const _sessionData: any = sessionData;
|
||||
const _sessionId: Buffer = sessionId;
|
||||
const _sessionData: Buffer = sessionData;
|
||||
const _func1 = callback;
|
||||
});
|
||||
_server = _server.once("OCSPRequest", (certificate, issuer, callback) => {
|
||||
@@ -101,7 +101,7 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
const _callback: Function = callback;
|
||||
});
|
||||
_server = _server.once("resumeSession", (sessionId, callback) => {
|
||||
const _sessionId: any = sessionId;
|
||||
const _sessionId: Buffer = sessionId;
|
||||
const _func2 = callback;
|
||||
});
|
||||
_server = _server.once("secureConnection", (tlsSocket) => {
|
||||
@@ -113,8 +113,8 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
const _tlsSocket: TLSSocket = tlsSocket;
|
||||
});
|
||||
_server = _server.prependListener("newSession", (sessionId, sessionData, callback) => {
|
||||
const _sessionId: any = sessionId;
|
||||
const _sessionData: any = sessionData;
|
||||
const _sessionId: Buffer = sessionId;
|
||||
const _sessionData: Buffer = sessionData;
|
||||
const _func1 = callback;
|
||||
});
|
||||
_server = _server.prependListener("OCSPRequest", (certificate, issuer, callback) => {
|
||||
@@ -123,7 +123,7 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
const _callback: Function = callback;
|
||||
});
|
||||
_server = _server.prependListener("resumeSession", (sessionId, callback) => {
|
||||
const _sessionId: any = sessionId;
|
||||
const _sessionId: Buffer = sessionId;
|
||||
const _func2 = callback;
|
||||
});
|
||||
_server = _server.prependListener("secureConnection", (tlsSocket) => {
|
||||
@@ -135,8 +135,8 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
const _tlsSocket: TLSSocket = tlsSocket;
|
||||
});
|
||||
_server = _server.prependOnceListener("newSession", (sessionId, sessionData, callback) => {
|
||||
const _sessionId: any = sessionId;
|
||||
const _sessionData: any = sessionData;
|
||||
const _sessionId: Buffer = sessionId;
|
||||
const _sessionData: Buffer = sessionData;
|
||||
const _func1 = callback;
|
||||
});
|
||||
_server = _server.prependOnceListener("OCSPRequest", (certificate, issuer, callback) => {
|
||||
@@ -145,7 +145,7 @@ import { createSecureContext, SecureContext, ConnectionOptions, connect, getCiph
|
||||
const _callback: Function = callback;
|
||||
});
|
||||
_server = _server.prependOnceListener("resumeSession", (sessionId, callback) => {
|
||||
const _sessionId: any = sessionId;
|
||||
const _sessionId: Buffer = sessionId;
|
||||
const _func2 = callback;
|
||||
});
|
||||
_server = _server.prependOnceListener("secureConnection", (tlsSocket) => {
|
||||
|
||||
50
types/node/tls.d.ts
vendored
50
types/node/tls.d.ts
vendored
@@ -180,13 +180,13 @@ declare module "tls" {
|
||||
* Could be used to speed up handshake establishment when reconnecting to the server.
|
||||
* @returns ASN.1 encoded TLS session or undefined if none was negotiated.
|
||||
*/
|
||||
getSession(): any;
|
||||
getSession(): Buffer | undefined;
|
||||
/**
|
||||
* NOTE: Works only with client TLS sockets.
|
||||
* Useful only for debugging, for session reuse provide session option to tls.connect().
|
||||
* @returns TLS session ticket or undefined if none was negotiated.
|
||||
*/
|
||||
getTLSTicket(): any;
|
||||
getTLSTicket(): Buffer | undefined;
|
||||
/**
|
||||
* Initiate TLS renegotiation process.
|
||||
*
|
||||
@@ -196,8 +196,9 @@ declare module "tls" {
|
||||
* requestCert (See tls.createServer() for details).
|
||||
* @param callback - callback(err) will be executed with null as err, once the renegotiation
|
||||
* is successfully completed.
|
||||
* @return `undefined` when socket is destroy, `false` if negotiaion can't be initiated.
|
||||
*/
|
||||
renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): any;
|
||||
renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): undefined | boolean;
|
||||
/**
|
||||
* Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512).
|
||||
* Smaller fragment size decreases buffering latency on the client: large fragments are buffered by
|
||||
@@ -291,50 +292,50 @@ declare module "tls" {
|
||||
*/
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
|
||||
addListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
|
||||
addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
|
||||
addListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
|
||||
addListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
|
||||
addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
|
||||
addListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
|
||||
addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean;
|
||||
emit(event: "newSession", sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void): boolean;
|
||||
emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: Function): boolean;
|
||||
emit(event: "resumeSession", sessionId: any, callback: (err: Error, sessionData: any) => void): boolean;
|
||||
emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void): boolean;
|
||||
emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean;
|
||||
emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean;
|
||||
emit(event: "secureConnection", tlsSocket: TLSSocket): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
|
||||
on(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
|
||||
on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
|
||||
on(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
|
||||
on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
|
||||
on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
|
||||
on(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
|
||||
on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
|
||||
once(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
|
||||
once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
|
||||
once(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
|
||||
once(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
|
||||
once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
|
||||
once(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
|
||||
once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
|
||||
prependListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
|
||||
prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
|
||||
prependListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
|
||||
prependListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
|
||||
prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
|
||||
prependListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
|
||||
prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
|
||||
prependOnceListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
|
||||
prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
|
||||
prependOnceListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
|
||||
prependOnceListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
|
||||
prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
|
||||
prependOnceListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
|
||||
prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
|
||||
}
|
||||
|
||||
interface SecurePair {
|
||||
encrypted: any;
|
||||
cleartext: any;
|
||||
encrypted: TLSSocket;
|
||||
cleartext: TLSSocket;
|
||||
}
|
||||
|
||||
type SecureVersion = 'TLSv1.2' | 'TLSv1.1' | 'TLSv1';
|
||||
@@ -388,6 +389,9 @@ declare module "tls" {
|
||||
function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
|
||||
function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
|
||||
function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
function createSecurePair(credentials?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
|
||||
function createSecureContext(details: SecureContextOptions): SecureContext;
|
||||
function getCiphers(): string[];
|
||||
|
||||
@@ -42,25 +42,30 @@
|
||||
"vm.d.ts",
|
||||
"worker_threads.d.ts",
|
||||
"zlib.d.ts",
|
||||
"node-tests.ts",
|
||||
|
||||
"node-tests.ts",
|
||||
"test/assert.ts",
|
||||
"test/buffer.ts",
|
||||
"test/child_process.ts",
|
||||
"test/cluster.ts",
|
||||
"test/crypto.ts",
|
||||
"test/dgram.ts",
|
||||
"test/global.ts",
|
||||
"test/http.ts",
|
||||
"test/http2.ts",
|
||||
"test/net.ts",
|
||||
"test/os.ts",
|
||||
"test/path.ts",
|
||||
"test/perf_hooks.ts",
|
||||
"test/querystring.ts",
|
||||
"test/readline.ts",
|
||||
"test/repl.ts",
|
||||
"test/stream.ts",
|
||||
"test/tls.ts",
|
||||
"test/tty.ts",
|
||||
"test/util.ts",
|
||||
"test/repl.ts",
|
||||
"test/worker_threads.ts",
|
||||
"test/zlib.ts",
|
||||
"test/tls.ts"
|
||||
"test/zlib.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
|
||||
18
types/node/worker_threads.d.ts
vendored
18
types/node/worker_threads.d.ts
vendored
@@ -72,51 +72,51 @@ declare module "worker_threads" {
|
||||
postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
|
||||
ref(): void;
|
||||
unref(): void;
|
||||
terminate(callback?: (err: any, exitCode: number) => void): void;
|
||||
terminate(callback?: (err: Error, exitCode: number) => void): void;
|
||||
|
||||
addListener(event: "error", listener: (err: any) => void): this;
|
||||
addListener(event: "error", listener: (err: Error) => void): this;
|
||||
addListener(event: "exit", listener: (exitCode: number) => void): this;
|
||||
addListener(event: "message", listener: (value: any) => void): this;
|
||||
addListener(event: "online", listener: () => void): this;
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: "error", err: any): boolean;
|
||||
emit(event: "error", err: Error): boolean;
|
||||
emit(event: "exit", exitCode: number): boolean;
|
||||
emit(event: "message", value: any): boolean;
|
||||
emit(event: "online"): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
|
||||
on(event: "error", listener: (err: any) => void): this;
|
||||
on(event: "error", listener: (err: Error) => void): this;
|
||||
on(event: "exit", listener: (exitCode: number) => void): this;
|
||||
on(event: "message", listener: (value: any) => void): this;
|
||||
on(event: "online", listener: () => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: "error", listener: (err: any) => void): this;
|
||||
once(event: "error", listener: (err: Error) => void): this;
|
||||
once(event: "exit", listener: (exitCode: number) => void): this;
|
||||
once(event: "message", listener: (value: any) => void): this;
|
||||
once(event: "online", listener: () => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener(event: "error", listener: (err: any) => void): this;
|
||||
prependListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependListener(event: "exit", listener: (exitCode: number) => void): this;
|
||||
prependListener(event: "message", listener: (value: any) => void): this;
|
||||
prependListener(event: "online", listener: () => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener(event: "error", listener: (err: any) => void): this;
|
||||
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependOnceListener(event: "exit", listener: (exitCode: number) => void): this;
|
||||
prependOnceListener(event: "message", listener: (value: any) => void): this;
|
||||
prependOnceListener(event: "online", listener: () => void): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
removeListener(event: "error", listener: (err: any) => void): this;
|
||||
removeListener(event: "error", listener: (err: Error) => void): this;
|
||||
removeListener(event: "exit", listener: (exitCode: number) => void): this;
|
||||
removeListener(event: "message", listener: (value: any) => void): this;
|
||||
removeListener(event: "online", listener: () => void): this;
|
||||
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
off(event: "error", listener: (err: any) => void): this;
|
||||
off(event: "error", listener: (err: Error) => void): this;
|
||||
off(event: "exit", listener: (exitCode: number) => void): this;
|
||||
off(event: "message", listener: (value: any) => void): this;
|
||||
off(event: "online", listener: () => void): this;
|
||||
|
||||
Reference in New Issue
Block a user