mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Node: remove ts3.1 support (#47645)
* node: remove TS3.1 Typescript 3.1 is no longer supported on DT. This commit removes 3.1 support for v6-10. I'll finish 11-14 tomorrow. * remove ts3.1 for node/v11 * Remove ts3.1 from node/v12 Also restore deleted tests to node/v11 * Remove ts3.1 from node/v13 Also fix up imports in node/v11 tests * remove ts3.1 from node
This commit is contained in:
parent
f87f81730a
commit
f621a2d639
2159
types/node/fs.d.ts
vendored
2159
types/node/fs.d.ts
vendored
File diff suppressed because it is too large
Load Diff
607
types/node/globals.d.ts
vendored
607
types/node/globals.d.ts
vendored
@ -1,13 +1,606 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="ts3.1/globals.d.ts" />
|
||||
// Declare "static" methods in Error
|
||||
interface ErrorConstructor {
|
||||
/** Create .stack property on a target object */
|
||||
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
||||
|
||||
interface Buffer extends Uint8Array {
|
||||
readBigUInt64BE(offset?: number): bigint;
|
||||
readBigUInt64LE(offset?: number): bigint;
|
||||
readBigInt64BE(offset?: number): bigint;
|
||||
readBigInt64LE(offset?: number): bigint;
|
||||
/**
|
||||
* Optional override for formatting stack traces
|
||||
*
|
||||
* @see https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces
|
||||
*/
|
||||
prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
|
||||
|
||||
stackTraceLimit: number;
|
||||
}
|
||||
|
||||
// Node.js ESNEXT support
|
||||
interface String {
|
||||
/** Removes whitespace from the left end of a string. */
|
||||
trimLeft(): string;
|
||||
/** Removes whitespace from the right end of a string. */
|
||||
trimRight(): string;
|
||||
|
||||
/** Returns a copy with leading whitespace removed. */
|
||||
trimStart(): string;
|
||||
/** Returns a copy with trailing whitespace removed. */
|
||||
trimEnd(): string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
url: string;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*
|
||||
* *
|
||||
* GLOBAL *
|
||||
* *
|
||||
------------------------------------------------*/
|
||||
|
||||
// For backwards compability
|
||||
interface NodeRequire extends NodeJS.Require {}
|
||||
interface RequireResolve extends NodeJS.RequireResolve {}
|
||||
interface NodeModule extends NodeJS.Module {}
|
||||
|
||||
declare var process: NodeJS.Process;
|
||||
declare var console: Console;
|
||||
|
||||
declare var __filename: string;
|
||||
declare var __dirname: string;
|
||||
|
||||
declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
|
||||
declare namespace setTimeout {
|
||||
function __promisify__(ms: number): Promise<void>;
|
||||
function __promisify__<T>(ms: number, value: T): Promise<T>;
|
||||
}
|
||||
declare function clearTimeout(timeoutId: NodeJS.Timeout): void;
|
||||
declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
|
||||
declare function clearInterval(intervalId: NodeJS.Timeout): void;
|
||||
declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate;
|
||||
declare namespace setImmediate {
|
||||
function __promisify__(): Promise<void>;
|
||||
function __promisify__<T>(value: T): Promise<T>;
|
||||
}
|
||||
declare function clearImmediate(immediateId: NodeJS.Immediate): void;
|
||||
|
||||
declare function queueMicrotask(callback: () => void): void;
|
||||
|
||||
declare var require: NodeRequire;
|
||||
declare var module: NodeModule;
|
||||
|
||||
// Same as module.exports
|
||||
declare var exports: any;
|
||||
|
||||
// Buffer class
|
||||
type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
|
||||
|
||||
/**
|
||||
* Raw data is stored in instances of the Buffer class.
|
||||
* A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
|
||||
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
||||
*/
|
||||
declare class Buffer extends Uint8Array {
|
||||
/**
|
||||
* Allocates a new buffer containing the given {str}.
|
||||
*
|
||||
* @param str String to store in buffer.
|
||||
* @param encoding encoding to use, optional. Default is 'utf8'
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
|
||||
*/
|
||||
constructor(str: string, encoding?: BufferEncoding);
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
|
||||
*/
|
||||
constructor(size: number);
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
||||
*/
|
||||
constructor(array: Uint8Array);
|
||||
/**
|
||||
* Produces a Buffer backed by the same allocated memory as
|
||||
* the given {ArrayBuffer}/{SharedArrayBuffer}.
|
||||
*
|
||||
*
|
||||
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
|
||||
*/
|
||||
constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer);
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
||||
*/
|
||||
constructor(array: any[]);
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
||||
*
|
||||
* @param buffer The buffer to copy.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
|
||||
*/
|
||||
constructor(buffer: Buffer);
|
||||
/**
|
||||
* When passed a reference to the .buffer property of a TypedArray instance,
|
||||
* the newly created Buffer will share the same allocated memory as the TypedArray.
|
||||
* The optional {byteOffset} and {length} arguments specify a memory range
|
||||
* within the {arrayBuffer} that will be shared by the Buffer.
|
||||
*
|
||||
* @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer()
|
||||
*/
|
||||
static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer using the passed {data}
|
||||
* @param data data to create a new Buffer
|
||||
*/
|
||||
static from(data: number[]): Buffer;
|
||||
static from(data: Uint8Array): Buffer;
|
||||
/**
|
||||
* Creates a new buffer containing the coerced value of an object
|
||||
* A `TypeError` will be thrown if {obj} has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants.
|
||||
* @param obj An object supporting `Symbol.toPrimitive` or `valueOf()`.
|
||||
*/
|
||||
static from(obj: { valueOf(): string | object } | { [Symbol.toPrimitive](hint: 'string'): string }, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
||||
* If provided, the {encoding} parameter identifies the character encoding.
|
||||
* If not provided, {encoding} defaults to 'utf8'.
|
||||
*/
|
||||
static from(str: string, encoding?: BufferEncoding): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer using the passed {data}
|
||||
* @param values to create a new Buffer
|
||||
*/
|
||||
static of(...items: number[]): Buffer;
|
||||
/**
|
||||
* Returns true if {obj} is a Buffer
|
||||
*
|
||||
* @param obj object to test.
|
||||
*/
|
||||
static isBuffer(obj: any): obj is Buffer;
|
||||
/**
|
||||
* Returns true if {encoding} is a valid encoding argument.
|
||||
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
||||
*
|
||||
* @param encoding string to test.
|
||||
*/
|
||||
static isEncoding(encoding: string): encoding is BufferEncoding;
|
||||
/**
|
||||
* Gives the actual byte length of a string. encoding defaults to 'utf8'.
|
||||
* This is not the same as String.prototype.length since that returns the number of characters in a string.
|
||||
*
|
||||
* @param string string to test.
|
||||
* @param encoding encoding used to evaluate (defaults to 'utf8')
|
||||
*/
|
||||
static byteLength(
|
||||
string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
|
||||
encoding?: BufferEncoding
|
||||
): number;
|
||||
/**
|
||||
* Returns a buffer which is the result of concatenating all the buffers in the list together.
|
||||
*
|
||||
* If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
|
||||
* If the list has exactly one item, then the first item of the list is returned.
|
||||
* If the list has more than one item, then a new Buffer is created.
|
||||
*
|
||||
* @param list An array of Buffer objects to concatenate
|
||||
* @param totalLength Total length of the buffers when concatenated.
|
||||
* If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
|
||||
*/
|
||||
static concat(list: Uint8Array[], totalLength?: number): Buffer;
|
||||
/**
|
||||
* The same as buf1.compare(buf2).
|
||||
*/
|
||||
static compare(buf1: Uint8Array, buf2: Uint8Array): number;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
* @param fill if specified, buffer will be initialized by calling buf.fill(fill).
|
||||
* If parameter is omitted, buffer will be filled with zeros.
|
||||
* @param encoding encoding used for call to buf.fill while initalizing
|
||||
*/
|
||||
static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
static allocUnsafe(size: number): Buffer;
|
||||
/**
|
||||
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
static allocUnsafeSlow(size: number): Buffer;
|
||||
/**
|
||||
* This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified.
|
||||
*/
|
||||
static poolSize: number;
|
||||
|
||||
write(string: string, encoding?: BufferEncoding): number;
|
||||
write(string: string, offset: number, encoding?: BufferEncoding): number;
|
||||
write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
|
||||
toString(encoding?: BufferEncoding, start?: number, end?: number): string;
|
||||
toJSON(): { type: 'Buffer'; data: number[] };
|
||||
equals(otherBuffer: Uint8Array): boolean;
|
||||
compare(
|
||||
otherBuffer: Uint8Array,
|
||||
targetStart?: number,
|
||||
targetEnd?: number,
|
||||
sourceStart?: number,
|
||||
sourceEnd?: number
|
||||
): number;
|
||||
copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
/**
|
||||
* Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
|
||||
*
|
||||
* This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory.
|
||||
*
|
||||
* @param begin Where the new `Buffer` will start. Default: `0`.
|
||||
* @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
|
||||
*/
|
||||
slice(begin?: number, end?: number): Buffer;
|
||||
/**
|
||||
* Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
|
||||
*
|
||||
* This method is compatible with `Uint8Array#subarray()`.
|
||||
*
|
||||
* @param begin Where the new `Buffer` will start. Default: `0`.
|
||||
* @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
|
||||
*/
|
||||
subarray(begin?: number, end?: number): Buffer;
|
||||
writeBigInt64BE(value: bigint, offset?: number): number;
|
||||
writeBigInt64LE(value: bigint, offset?: number): number;
|
||||
writeBigUInt64BE(value: bigint, offset?: number): number;
|
||||
writeBigUInt64LE(value: bigint, offset?: number): number;
|
||||
writeUIntLE(value: number, offset: number, byteLength: number): number;
|
||||
writeUIntBE(value: number, offset: number, byteLength: number): number;
|
||||
writeIntLE(value: number, offset: number, byteLength: number): number;
|
||||
writeIntBE(value: number, offset: number, byteLength: number): number;
|
||||
readBigUInt64BE(offset?: number): bigint;
|
||||
readBigUInt64LE(offset?: number): bigint;
|
||||
readBigInt64BE(offset?: number): bigint;
|
||||
readBigInt64LE(offset?: number): bigint;
|
||||
readUIntLE(offset: number, byteLength: number): number;
|
||||
readUIntBE(offset: number, byteLength: number): number;
|
||||
readIntLE(offset: number, byteLength: number): number;
|
||||
readIntBE(offset: number, byteLength: number): number;
|
||||
readUInt8(offset?: number): number;
|
||||
readUInt16LE(offset?: number): number;
|
||||
readUInt16BE(offset?: number): number;
|
||||
readUInt32LE(offset?: number): number;
|
||||
readUInt32BE(offset?: number): number;
|
||||
readInt8(offset?: number): number;
|
||||
readInt16LE(offset?: number): number;
|
||||
readInt16BE(offset?: number): number;
|
||||
readInt32LE(offset?: number): number;
|
||||
readInt32BE(offset?: number): number;
|
||||
readFloatLE(offset?: number): number;
|
||||
readFloatBE(offset?: number): number;
|
||||
readDoubleLE(offset?: number): number;
|
||||
readDoubleBE(offset?: number): number;
|
||||
reverse(): this;
|
||||
swap16(): Buffer;
|
||||
swap32(): Buffer;
|
||||
swap64(): Buffer;
|
||||
writeUInt8(value: number, offset?: number): number;
|
||||
writeUInt16LE(value: number, offset?: number): number;
|
||||
writeUInt16BE(value: number, offset?: number): number;
|
||||
writeUInt32LE(value: number, offset?: number): number;
|
||||
writeUInt32BE(value: number, offset?: number): number;
|
||||
writeInt8(value: number, offset?: number): number;
|
||||
writeInt16LE(value: number, offset?: number): number;
|
||||
writeInt16BE(value: number, offset?: number): number;
|
||||
writeInt32LE(value: number, offset?: number): number;
|
||||
writeInt32BE(value: number, offset?: number): number;
|
||||
writeFloatLE(value: number, offset?: number): number;
|
||||
writeFloatBE(value: number, offset?: number): number;
|
||||
writeDoubleLE(value: number, offset?: number): number;
|
||||
writeDoubleBE(value: number, offset?: number): number;
|
||||
|
||||
fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
|
||||
|
||||
indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
||||
lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
|
||||
keys(): IterableIterator<number>;
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
/*----------------------------------------------*
|
||||
* *
|
||||
* GLOBAL INTERFACES *
|
||||
* *
|
||||
*-----------------------------------------------*/
|
||||
declare namespace NodeJS {
|
||||
interface InspectOptions {
|
||||
/**
|
||||
* If set to `true`, getters are going to be
|
||||
* inspected as well. If set to `'get'` only getters without setter are going
|
||||
* to be inspected. If set to `'set'` only getters having a corresponding
|
||||
* setter are going to be inspected. This might cause side effects depending on
|
||||
* the getter function.
|
||||
* @default `false`
|
||||
*/
|
||||
getters?: 'get' | 'set' | boolean;
|
||||
showHidden?: boolean;
|
||||
/**
|
||||
* @default 2
|
||||
*/
|
||||
depth?: number | null;
|
||||
colors?: boolean;
|
||||
customInspect?: boolean;
|
||||
showProxy?: boolean;
|
||||
maxArrayLength?: number | null;
|
||||
/**
|
||||
* Specifies the maximum number of characters to
|
||||
* include when formatting. Set to `null` or `Infinity` to show all elements.
|
||||
* Set to `0` or negative to show no characters.
|
||||
* @default Infinity
|
||||
*/
|
||||
maxStringLength?: number | null;
|
||||
breakLength?: number;
|
||||
/**
|
||||
* Setting this to `false` causes each object key
|
||||
* to be displayed on a new line. It will also add new lines to text that is
|
||||
* longer than `breakLength`. If set to a number, the most `n` inner elements
|
||||
* are united on a single line as long as all properties fit into
|
||||
* `breakLength`. Short array elements are also grouped together. Note that no
|
||||
* text will be reduced below 16 characters, no matter the `breakLength` size.
|
||||
* For more information, see the example below.
|
||||
* @default `true`
|
||||
*/
|
||||
compact?: boolean | number;
|
||||
sorted?: boolean | ((a: string, b: string) => number);
|
||||
}
|
||||
|
||||
interface CallSite {
|
||||
/**
|
||||
* Value of "this"
|
||||
*/
|
||||
getThis(): any;
|
||||
|
||||
/**
|
||||
* Type of "this" as a string.
|
||||
* This is the name of the function stored in the constructor field of
|
||||
* "this", if available. Otherwise the object's [[Class]] internal
|
||||
* property.
|
||||
*/
|
||||
getTypeName(): string | null;
|
||||
|
||||
/**
|
||||
* Current function
|
||||
*/
|
||||
getFunction(): Function | undefined;
|
||||
|
||||
/**
|
||||
* Name of the current function, typically its name property.
|
||||
* If a name property is not available an attempt will be made to try
|
||||
* to infer a name from the function's context.
|
||||
*/
|
||||
getFunctionName(): string | null;
|
||||
|
||||
/**
|
||||
* Name of the property [of "this" or one of its prototypes] that holds
|
||||
* the current function
|
||||
*/
|
||||
getMethodName(): string | null;
|
||||
|
||||
/**
|
||||
* Name of the script [if this function was defined in a script]
|
||||
*/
|
||||
getFileName(): string | null;
|
||||
|
||||
/**
|
||||
* Current line number [if this function was defined in a script]
|
||||
*/
|
||||
getLineNumber(): number | null;
|
||||
|
||||
/**
|
||||
* Current column number [if this function was defined in a script]
|
||||
*/
|
||||
getColumnNumber(): number | null;
|
||||
|
||||
/**
|
||||
* A call site object representing the location where eval was called
|
||||
* [if this function was created using a call to eval]
|
||||
*/
|
||||
getEvalOrigin(): string | undefined;
|
||||
|
||||
/**
|
||||
* Is this a toplevel invocation, that is, is "this" the global object?
|
||||
*/
|
||||
isToplevel(): boolean;
|
||||
|
||||
/**
|
||||
* Does this call take place in code defined by a call to eval?
|
||||
*/
|
||||
isEval(): boolean;
|
||||
|
||||
/**
|
||||
* Is this call in native V8 code?
|
||||
*/
|
||||
isNative(): boolean;
|
||||
|
||||
/**
|
||||
* Is this a constructor call?
|
||||
*/
|
||||
isConstructor(): boolean;
|
||||
}
|
||||
|
||||
interface ErrnoException extends Error {
|
||||
errno?: number;
|
||||
code?: string;
|
||||
path?: string;
|
||||
syscall?: string;
|
||||
stack?: string;
|
||||
}
|
||||
|
||||
interface ReadableStream extends EventEmitter {
|
||||
readable: boolean;
|
||||
read(size?: number): string | Buffer;
|
||||
setEncoding(encoding: BufferEncoding): this;
|
||||
pause(): this;
|
||||
resume(): this;
|
||||
isPaused(): boolean;
|
||||
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe(destination?: WritableStream): this;
|
||||
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
||||
wrap(oldStream: ReadableStream): this;
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
|
||||
}
|
||||
|
||||
interface WritableStream extends EventEmitter {
|
||||
writable: boolean;
|
||||
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
||||
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
||||
end(cb?: () => void): void;
|
||||
end(data: string | Uint8Array, cb?: () => void): void;
|
||||
end(str: string, encoding?: BufferEncoding, cb?: () => void): void;
|
||||
}
|
||||
|
||||
interface ReadWriteStream extends ReadableStream, WritableStream { }
|
||||
|
||||
interface Global {
|
||||
Array: typeof Array;
|
||||
ArrayBuffer: typeof ArrayBuffer;
|
||||
Boolean: typeof Boolean;
|
||||
Buffer: typeof Buffer;
|
||||
DataView: typeof DataView;
|
||||
Date: typeof Date;
|
||||
Error: typeof Error;
|
||||
EvalError: typeof EvalError;
|
||||
Float32Array: typeof Float32Array;
|
||||
Float64Array: typeof Float64Array;
|
||||
Function: typeof Function;
|
||||
Infinity: typeof Infinity;
|
||||
Int16Array: typeof Int16Array;
|
||||
Int32Array: typeof Int32Array;
|
||||
Int8Array: typeof Int8Array;
|
||||
Intl: typeof Intl;
|
||||
JSON: typeof JSON;
|
||||
Map: MapConstructor;
|
||||
Math: typeof Math;
|
||||
NaN: typeof NaN;
|
||||
Number: typeof Number;
|
||||
Object: typeof Object;
|
||||
Promise: typeof Promise;
|
||||
RangeError: typeof RangeError;
|
||||
ReferenceError: typeof ReferenceError;
|
||||
RegExp: typeof RegExp;
|
||||
Set: SetConstructor;
|
||||
String: typeof String;
|
||||
Symbol: Function;
|
||||
SyntaxError: typeof SyntaxError;
|
||||
TypeError: typeof TypeError;
|
||||
URIError: typeof URIError;
|
||||
Uint16Array: typeof Uint16Array;
|
||||
Uint32Array: typeof Uint32Array;
|
||||
Uint8Array: typeof Uint8Array;
|
||||
Uint8ClampedArray: typeof Uint8ClampedArray;
|
||||
WeakMap: WeakMapConstructor;
|
||||
WeakSet: WeakSetConstructor;
|
||||
clearImmediate: (immediateId: Immediate) => void;
|
||||
clearInterval: (intervalId: Timeout) => void;
|
||||
clearTimeout: (timeoutId: Timeout) => void;
|
||||
decodeURI: typeof decodeURI;
|
||||
decodeURIComponent: typeof decodeURIComponent;
|
||||
encodeURI: typeof encodeURI;
|
||||
encodeURIComponent: typeof encodeURIComponent;
|
||||
escape: (str: string) => string;
|
||||
eval: typeof eval;
|
||||
global: Global;
|
||||
isFinite: typeof isFinite;
|
||||
isNaN: typeof isNaN;
|
||||
parseFloat: typeof parseFloat;
|
||||
parseInt: typeof parseInt;
|
||||
setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => Immediate;
|
||||
setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;
|
||||
setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;
|
||||
queueMicrotask: typeof queueMicrotask;
|
||||
undefined: typeof undefined;
|
||||
unescape: (str: string) => string;
|
||||
gc: () => void;
|
||||
v8debug?: any;
|
||||
}
|
||||
|
||||
interface RefCounted {
|
||||
ref(): this;
|
||||
unref(): this;
|
||||
}
|
||||
|
||||
// compatibility with older typings
|
||||
interface Timer extends RefCounted {
|
||||
hasRef(): boolean;
|
||||
refresh(): this;
|
||||
}
|
||||
|
||||
interface Immediate extends RefCounted {
|
||||
hasRef(): boolean;
|
||||
_onImmediate: Function; // to distinguish it from the Timeout class
|
||||
}
|
||||
|
||||
interface Timeout extends Timer {
|
||||
hasRef(): boolean;
|
||||
refresh(): this;
|
||||
}
|
||||
|
||||
type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
|
||||
type ArrayBufferView = TypedArray | DataView;
|
||||
|
||||
interface Require {
|
||||
/* tslint:disable-next-line:callable-types */
|
||||
(id: string): any;
|
||||
resolve: RequireResolve;
|
||||
cache: Dict<NodeModule>;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
extensions: RequireExtensions;
|
||||
main: Module | undefined;
|
||||
}
|
||||
|
||||
interface RequireResolve {
|
||||
(id: string, options?: { paths?: string[]; }): string;
|
||||
paths(request: string): string[] | null;
|
||||
}
|
||||
|
||||
interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
|
||||
'.js': (m: Module, filename: string) => any;
|
||||
'.json': (m: Module, filename: string) => any;
|
||||
'.node': (m: Module, filename: string) => any;
|
||||
}
|
||||
interface Module {
|
||||
exports: any;
|
||||
require: Require;
|
||||
id: string;
|
||||
filename: string;
|
||||
loaded: boolean;
|
||||
/** @deprecated since 14.6.0 Please use `require.main` and `module.children` instead. */
|
||||
parent: Module | null | undefined;
|
||||
children: Module[];
|
||||
/**
|
||||
* @since 11.14.0
|
||||
*
|
||||
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
|
||||
*/
|
||||
path: string;
|
||||
paths: string[];
|
||||
}
|
||||
|
||||
interface Dict<T> {
|
||||
[key: string]: T | undefined;
|
||||
}
|
||||
|
||||
interface ReadOnlyDict<T> {
|
||||
readonly [key: string]: T | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,11 +2,6 @@
|
||||
"private": true,
|
||||
"types": "index",
|
||||
"typesVersions": {
|
||||
"<=3.1": {
|
||||
"*": [
|
||||
"ts3.1/*"
|
||||
]
|
||||
},
|
||||
"<=3.4": {
|
||||
"*": [
|
||||
"ts3.4/*"
|
||||
|
||||
400
types/node/process.d.ts
vendored
400
types/node/process.d.ts
vendored
@ -1,12 +1,406 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="ts3.1/process.d.ts" />
|
||||
declare module "process" {
|
||||
import * as tty from "tty";
|
||||
|
||||
declare module 'process' {
|
||||
global {
|
||||
var process: NodeJS.Process;
|
||||
|
||||
namespace NodeJS {
|
||||
// this namespace merge is here because these are specifically used
|
||||
// as the type for process.stdin, process.stdout, and process.stderr.
|
||||
// they can't live in tty.d.ts because we need to disambiguate the imported name.
|
||||
interface ReadStream extends tty.ReadStream {}
|
||||
interface WriteStream extends tty.WriteStream {}
|
||||
|
||||
interface MemoryUsage {
|
||||
rss: number;
|
||||
heapTotal: number;
|
||||
heapUsed: number;
|
||||
external: number;
|
||||
arrayBuffers: number;
|
||||
}
|
||||
|
||||
interface CpuUsage {
|
||||
user: number;
|
||||
system: number;
|
||||
}
|
||||
|
||||
interface ProcessRelease {
|
||||
name: string;
|
||||
sourceUrl?: string;
|
||||
headersUrl?: string;
|
||||
libUrl?: string;
|
||||
lts?: string;
|
||||
}
|
||||
|
||||
interface ProcessVersions extends Dict<string> {
|
||||
http_parser: string;
|
||||
node: string;
|
||||
v8: string;
|
||||
ares: string;
|
||||
uv: string;
|
||||
zlib: string;
|
||||
modules: string;
|
||||
openssl: string;
|
||||
}
|
||||
|
||||
type Platform = 'aix'
|
||||
| 'android'
|
||||
| 'darwin'
|
||||
| 'freebsd'
|
||||
| 'linux'
|
||||
| 'openbsd'
|
||||
| 'sunos'
|
||||
| 'win32'
|
||||
| 'cygwin'
|
||||
| 'netbsd';
|
||||
|
||||
type Signals =
|
||||
"SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" |
|
||||
"SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" |
|
||||
"SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" |
|
||||
"SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
|
||||
|
||||
type MultipleResolveType = 'resolve' | 'reject';
|
||||
|
||||
type BeforeExitListener = (code: number) => void;
|
||||
type DisconnectListener = () => void;
|
||||
type ExitListener = (code: number) => void;
|
||||
type RejectionHandledListener = (promise: Promise<any>) => void;
|
||||
type UncaughtExceptionListener = (error: Error) => void;
|
||||
type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<any>) => void;
|
||||
type WarningListener = (warning: Error) => void;
|
||||
type MessageListener = (message: any, sendHandle: any) => void;
|
||||
type SignalsListener = (signal: Signals) => void;
|
||||
type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
|
||||
type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
|
||||
type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<any>, value: any) => void;
|
||||
|
||||
interface Socket extends ReadWriteStream {
|
||||
isTTY?: true;
|
||||
}
|
||||
|
||||
// Alias for compatibility
|
||||
interface ProcessEnv extends Dict<string> {}
|
||||
|
||||
interface HRTime {
|
||||
(time?: [number, number]): [number, number];
|
||||
bigint(): bigint;
|
||||
}
|
||||
|
||||
interface ProcessReport {
|
||||
/**
|
||||
* Directory where the report is written.
|
||||
* working directory of the Node.js process.
|
||||
* @default '' indicating that reports are written to the current
|
||||
*/
|
||||
directory: string;
|
||||
|
||||
/**
|
||||
* Filename where the report is written.
|
||||
* The default value is the empty string.
|
||||
* @default '' the output filename will be comprised of a timestamp,
|
||||
* PID, and sequence number.
|
||||
*/
|
||||
filename: string;
|
||||
|
||||
/**
|
||||
* Returns a JSON-formatted diagnostic report for the running process.
|
||||
* The report's JavaScript stack trace is taken from err, if present.
|
||||
*/
|
||||
getReport(err?: Error): string;
|
||||
|
||||
/**
|
||||
* If true, a diagnostic report is generated on fatal errors,
|
||||
* such as out of memory errors or failed C++ assertions.
|
||||
* @default false
|
||||
*/
|
||||
reportOnFatalError: boolean;
|
||||
|
||||
/**
|
||||
* If true, a diagnostic report is generated when the process
|
||||
* receives the signal specified by process.report.signal.
|
||||
* @defaul false
|
||||
*/
|
||||
reportOnSignal: boolean;
|
||||
|
||||
/**
|
||||
* If true, a diagnostic report is generated on uncaught exception.
|
||||
* @default false
|
||||
*/
|
||||
reportOnUncaughtException: boolean;
|
||||
|
||||
/**
|
||||
* The signal used to trigger the creation of a diagnostic report.
|
||||
* @default 'SIGUSR2'
|
||||
*/
|
||||
signal: Signals;
|
||||
|
||||
/**
|
||||
* Writes a diagnostic report to a file. If filename is not provided, the default filename
|
||||
* includes the date, time, PID, and a sequence number.
|
||||
* The report's JavaScript stack trace is taken from err, if present.
|
||||
*
|
||||
* @param fileName Name of the file where the report is written.
|
||||
* This should be a relative path, that will be appended to the directory specified in
|
||||
* `process.report.directory`, or the current working directory of the Node.js process,
|
||||
* if unspecified.
|
||||
* @param error A custom error used for reporting the JavaScript stack.
|
||||
* @return Filename of the generated report.
|
||||
*/
|
||||
writeReport(fileName?: string): string;
|
||||
writeReport(error?: Error): string;
|
||||
writeReport(fileName?: string, err?: Error): string;
|
||||
}
|
||||
|
||||
interface ResourceUsage {
|
||||
fsRead: number;
|
||||
fsWrite: number;
|
||||
involuntaryContextSwitches: number;
|
||||
ipcReceived: number;
|
||||
ipcSent: number;
|
||||
majorPageFault: number;
|
||||
maxRSS: number;
|
||||
minorPageFault: number;
|
||||
sharedMemorySize: number;
|
||||
signalsCount: number;
|
||||
swappedOut: number;
|
||||
systemCPUTime: number;
|
||||
unsharedDataSize: number;
|
||||
unsharedStackSize: number;
|
||||
userCPUTime: number;
|
||||
voluntaryContextSwitches: number;
|
||||
}
|
||||
|
||||
interface Process extends EventEmitter {
|
||||
/**
|
||||
* Can also be a tty.WriteStream, not typed due to limitations.
|
||||
*/
|
||||
stdout: WriteStream & {
|
||||
fd: 1;
|
||||
};
|
||||
/**
|
||||
* Can also be a tty.WriteStream, not typed due to limitations.
|
||||
*/
|
||||
stderr: WriteStream & {
|
||||
fd: 2;
|
||||
};
|
||||
stdin: ReadStream & {
|
||||
fd: 0;
|
||||
};
|
||||
openStdin(): Socket;
|
||||
argv: string[];
|
||||
argv0: string;
|
||||
execArgv: string[];
|
||||
execPath: string;
|
||||
abort(): void;
|
||||
chdir(directory: string): void;
|
||||
cwd(): string;
|
||||
debugPort: number;
|
||||
emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
|
||||
env: ProcessEnv;
|
||||
exit(code?: number): never;
|
||||
exitCode?: number;
|
||||
getgid(): number;
|
||||
setgid(id: number | string): void;
|
||||
getuid(): number;
|
||||
setuid(id: number | string): void;
|
||||
geteuid(): number;
|
||||
seteuid(id: number | string): void;
|
||||
getegid(): number;
|
||||
setegid(id: number | string): void;
|
||||
getgroups(): number[];
|
||||
setgroups(groups: Array<string | number>): void;
|
||||
setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
|
||||
hasUncaughtExceptionCaptureCallback(): boolean;
|
||||
version: string;
|
||||
versions: ProcessVersions;
|
||||
config: {
|
||||
target_defaults: {
|
||||
cflags: any[];
|
||||
default_configuration: string;
|
||||
defines: string[];
|
||||
include_dirs: string[];
|
||||
libraries: string[];
|
||||
};
|
||||
variables: {
|
||||
clang: number;
|
||||
host_arch: string;
|
||||
node_install_npm: boolean;
|
||||
node_install_waf: boolean;
|
||||
node_prefix: string;
|
||||
node_shared_openssl: boolean;
|
||||
node_shared_v8: boolean;
|
||||
node_shared_zlib: boolean;
|
||||
node_use_dtrace: boolean;
|
||||
node_use_etw: boolean;
|
||||
node_use_openssl: boolean;
|
||||
target_arch: string;
|
||||
v8_no_strict_aliasing: number;
|
||||
v8_use_snapshot: boolean;
|
||||
visibility: string;
|
||||
};
|
||||
};
|
||||
kill(pid: number, signal?: string | number): true;
|
||||
pid: number;
|
||||
ppid: number;
|
||||
title: string;
|
||||
arch: string;
|
||||
platform: Platform;
|
||||
/** @deprecated since v14.0.0 - use `require.main` instead. */
|
||||
mainModule?: Module;
|
||||
memoryUsage(): MemoryUsage;
|
||||
cpuUsage(previousValue?: CpuUsage): CpuUsage;
|
||||
nextTick(callback: Function, ...args: any[]): void;
|
||||
release: ProcessRelease;
|
||||
features: {
|
||||
inspector: boolean;
|
||||
debug: boolean;
|
||||
uv: boolean;
|
||||
ipv6: boolean;
|
||||
tls_alpn: boolean;
|
||||
tls_sni: boolean;
|
||||
tls_ocsp: boolean;
|
||||
tls: boolean;
|
||||
};
|
||||
/**
|
||||
* @deprecated since v14.0.0 - Calling process.umask() with no argument causes
|
||||
* the process-wide umask to be written twice. This introduces a race condition between threads,
|
||||
* and is a potential security vulnerability. There is no safe, cross-platform alternative API.
|
||||
*/
|
||||
umask(): number;
|
||||
/**
|
||||
* Can only be set if not in worker thread.
|
||||
*/
|
||||
umask(mask: number): number;
|
||||
uptime(): number;
|
||||
hrtime: HRTime;
|
||||
domain: Domain;
|
||||
|
||||
// Worker
|
||||
send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean;
|
||||
disconnect(): void;
|
||||
connected: boolean;
|
||||
|
||||
/**
|
||||
* The `process.allowedNodeEnvironmentFlags` property is a special,
|
||||
* read-only `Set` of flags allowable within the [`NODE_OPTIONS`][]
|
||||
* environment variable.
|
||||
*/
|
||||
allowedNodeEnvironmentFlags: ReadonlySet<string>;
|
||||
|
||||
/**
|
||||
* Only available with `--experimental-report`
|
||||
*/
|
||||
report?: ProcessReport;
|
||||
|
||||
resourceUsage(): ResourceUsage;
|
||||
|
||||
/* EventEmitter */
|
||||
addListener(event: "beforeExit", listener: BeforeExitListener): this;
|
||||
addListener(event: "disconnect", listener: DisconnectListener): this;
|
||||
addListener(event: "exit", listener: ExitListener): this;
|
||||
addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
||||
addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
||||
addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
|
||||
addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
||||
addListener(event: "warning", listener: WarningListener): this;
|
||||
addListener(event: "message", listener: MessageListener): this;
|
||||
addListener(event: Signals, listener: SignalsListener): this;
|
||||
addListener(event: "newListener", listener: NewListenerListener): this;
|
||||
addListener(event: "removeListener", listener: RemoveListenerListener): this;
|
||||
addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
|
||||
emit(event: "beforeExit", code: number): boolean;
|
||||
emit(event: "disconnect"): boolean;
|
||||
emit(event: "exit", code: number): boolean;
|
||||
emit(event: "rejectionHandled", promise: Promise<any>): boolean;
|
||||
emit(event: "uncaughtException", error: Error): boolean;
|
||||
emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
|
||||
emit(event: "unhandledRejection", reason: any, promise: Promise<any>): boolean;
|
||||
emit(event: "warning", warning: Error): boolean;
|
||||
emit(event: "message", message: any, sendHandle: any): this;
|
||||
emit(event: Signals, signal: Signals): boolean;
|
||||
emit(event: "newListener", eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||
emit(event: "removeListener", eventName: string, listener: (...args: any[]) => void): this;
|
||||
emit(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
|
||||
on(event: "beforeExit", listener: BeforeExitListener): this;
|
||||
on(event: "disconnect", listener: DisconnectListener): this;
|
||||
on(event: "exit", listener: ExitListener): this;
|
||||
on(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
||||
on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
||||
on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
|
||||
on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
||||
on(event: "warning", listener: WarningListener): this;
|
||||
on(event: "message", listener: MessageListener): this;
|
||||
on(event: Signals, listener: SignalsListener): this;
|
||||
on(event: "newListener", listener: NewListenerListener): this;
|
||||
on(event: "removeListener", listener: RemoveListenerListener): this;
|
||||
on(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: "beforeExit", listener: BeforeExitListener): this;
|
||||
once(event: "disconnect", listener: DisconnectListener): this;
|
||||
once(event: "exit", listener: ExitListener): this;
|
||||
once(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
||||
once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
||||
once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
|
||||
once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
||||
once(event: "warning", listener: WarningListener): this;
|
||||
once(event: "message", listener: MessageListener): this;
|
||||
once(event: Signals, listener: SignalsListener): this;
|
||||
once(event: "newListener", listener: NewListenerListener): this;
|
||||
once(event: "removeListener", listener: RemoveListenerListener): this;
|
||||
once(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
|
||||
prependListener(event: "beforeExit", listener: BeforeExitListener): this;
|
||||
prependListener(event: "disconnect", listener: DisconnectListener): this;
|
||||
prependListener(event: "exit", listener: ExitListener): this;
|
||||
prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
||||
prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
||||
prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
|
||||
prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
||||
prependListener(event: "warning", listener: WarningListener): this;
|
||||
prependListener(event: "message", listener: MessageListener): this;
|
||||
prependListener(event: Signals, listener: SignalsListener): this;
|
||||
prependListener(event: "newListener", listener: NewListenerListener): this;
|
||||
prependListener(event: "removeListener", listener: RemoveListenerListener): this;
|
||||
prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
|
||||
prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
|
||||
prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
|
||||
prependOnceListener(event: "exit", listener: ExitListener): this;
|
||||
prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
||||
prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
||||
prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
|
||||
prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
||||
prependOnceListener(event: "warning", listener: WarningListener): this;
|
||||
prependOnceListener(event: "message", listener: MessageListener): this;
|
||||
prependOnceListener(event: Signals, listener: SignalsListener): this;
|
||||
prependOnceListener(event: "newListener", listener: NewListenerListener): this;
|
||||
prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this;
|
||||
prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
|
||||
listeners(event: "beforeExit"): BeforeExitListener[];
|
||||
listeners(event: "disconnect"): DisconnectListener[];
|
||||
listeners(event: "exit"): ExitListener[];
|
||||
listeners(event: "rejectionHandled"): RejectionHandledListener[];
|
||||
listeners(event: "uncaughtException"): UncaughtExceptionListener[];
|
||||
listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[];
|
||||
listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
|
||||
listeners(event: "warning"): WarningListener[];
|
||||
listeners(event: "message"): MessageListener[];
|
||||
listeners(event: Signals): SignalsListener[];
|
||||
listeners(event: "newListener"): NewListenerListener[];
|
||||
listeners(event: "removeListener"): RemoveListenerListener[];
|
||||
listeners(event: "multipleResolves"): MultipleResolveListener[];
|
||||
}
|
||||
|
||||
interface Global {
|
||||
process: Process;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = process;
|
||||
}
|
||||
|
||||
42
types/node/ts3.1/base.d.ts
vendored
42
types/node/ts3.1/base.d.ts
vendored
@ -1,42 +0,0 @@
|
||||
// base definitions for all NodeJS modules that are not specific to any version of TypeScript
|
||||
|
||||
/// <reference path="globals.d.ts" />
|
||||
/// <reference path="../async_hooks.d.ts" />
|
||||
/// <reference path="../buffer.d.ts" />
|
||||
/// <reference path="../child_process.d.ts" />
|
||||
/// <reference path="../cluster.d.ts" />
|
||||
/// <reference path="../console.d.ts" />
|
||||
/// <reference path="../constants.d.ts" />
|
||||
/// <reference path="../crypto.d.ts" />
|
||||
/// <reference path="../dgram.d.ts" />
|
||||
/// <reference path="../dns.d.ts" />
|
||||
/// <reference path="../domain.d.ts" />
|
||||
/// <reference path="../events.d.ts" />
|
||||
/// <reference path="fs.d.ts" />
|
||||
/// <reference path="../fs/promises.d.ts" />
|
||||
/// <reference path="../http.d.ts" />
|
||||
/// <reference path="../http2.d.ts" />
|
||||
/// <reference path="../https.d.ts" />
|
||||
/// <reference path="../inspector.d.ts" />
|
||||
/// <reference path="../module.d.ts" />
|
||||
/// <reference path="../net.d.ts" />
|
||||
/// <reference path="../os.d.ts" />
|
||||
/// <reference path="../path.d.ts" />
|
||||
/// <reference path="../perf_hooks.d.ts" />
|
||||
/// <reference path="process.d.ts" />
|
||||
/// <reference path="../punycode.d.ts" />
|
||||
/// <reference path="../querystring.d.ts" />
|
||||
/// <reference path="../readline.d.ts" />
|
||||
/// <reference path="../repl.d.ts" />
|
||||
/// <reference path="../stream.d.ts" />
|
||||
/// <reference path="../string_decoder.d.ts" />
|
||||
/// <reference path="../timers.d.ts" />
|
||||
/// <reference path="../tls.d.ts" />
|
||||
/// <reference path="../trace_events.d.ts" />
|
||||
/// <reference path="../tty.d.ts" />
|
||||
/// <reference path="../url.d.ts" />
|
||||
/// <reference path="util.d.ts" />
|
||||
/// <reference path="../v8.d.ts" />
|
||||
/// <reference path="../vm.d.ts" />
|
||||
/// <reference path="../worker_threads.d.ts" />
|
||||
/// <reference path="../zlib.d.ts" />
|
||||
2132
types/node/ts3.1/fs.d.ts
vendored
2132
types/node/ts3.1/fs.d.ts
vendored
File diff suppressed because it is too large
Load Diff
598
types/node/ts3.1/globals.d.ts
vendored
598
types/node/ts3.1/globals.d.ts
vendored
@ -1,598 +0,0 @@
|
||||
// Declare "static" methods in Error
|
||||
interface ErrorConstructor {
|
||||
/** Create .stack property on a target object */
|
||||
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
||||
|
||||
/**
|
||||
* Optional override for formatting stack traces
|
||||
*
|
||||
* @see https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces
|
||||
*/
|
||||
prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
|
||||
|
||||
stackTraceLimit: number;
|
||||
}
|
||||
|
||||
// Node.js ESNEXT support
|
||||
interface String {
|
||||
/** Removes whitespace from the left end of a string. */
|
||||
trimLeft(): string;
|
||||
/** Removes whitespace from the right end of a string. */
|
||||
trimRight(): string;
|
||||
|
||||
/** Returns a copy with leading whitespace removed. */
|
||||
trimStart(): string;
|
||||
/** Returns a copy with trailing whitespace removed. */
|
||||
trimEnd(): string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
url: string;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*
|
||||
* *
|
||||
* GLOBAL *
|
||||
* *
|
||||
------------------------------------------------*/
|
||||
|
||||
// For backwards compability
|
||||
interface NodeRequire extends NodeJS.Require {}
|
||||
interface RequireResolve extends NodeJS.RequireResolve {}
|
||||
interface NodeModule extends NodeJS.Module {}
|
||||
|
||||
declare var process: NodeJS.Process;
|
||||
declare var console: Console;
|
||||
|
||||
declare var __filename: string;
|
||||
declare var __dirname: string;
|
||||
|
||||
declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
|
||||
declare namespace setTimeout {
|
||||
function __promisify__(ms: number): Promise<void>;
|
||||
function __promisify__<T>(ms: number, value: T): Promise<T>;
|
||||
}
|
||||
declare function clearTimeout(timeoutId: NodeJS.Timeout): void;
|
||||
declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
|
||||
declare function clearInterval(intervalId: NodeJS.Timeout): void;
|
||||
declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate;
|
||||
declare namespace setImmediate {
|
||||
function __promisify__(): Promise<void>;
|
||||
function __promisify__<T>(value: T): Promise<T>;
|
||||
}
|
||||
declare function clearImmediate(immediateId: NodeJS.Immediate): void;
|
||||
|
||||
declare function queueMicrotask(callback: () => void): void;
|
||||
|
||||
declare var require: NodeRequire;
|
||||
declare var module: NodeModule;
|
||||
|
||||
// Same as module.exports
|
||||
declare var exports: any;
|
||||
|
||||
// Buffer class
|
||||
type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
|
||||
|
||||
/**
|
||||
* Raw data is stored in instances of the Buffer class.
|
||||
* A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
|
||||
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
||||
*/
|
||||
declare class Buffer extends Uint8Array {
|
||||
/**
|
||||
* Allocates a new buffer containing the given {str}.
|
||||
*
|
||||
* @param str String to store in buffer.
|
||||
* @param encoding encoding to use, optional. Default is 'utf8'
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
|
||||
*/
|
||||
constructor(str: string, encoding?: BufferEncoding);
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
|
||||
*/
|
||||
constructor(size: number);
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
||||
*/
|
||||
constructor(array: Uint8Array);
|
||||
/**
|
||||
* Produces a Buffer backed by the same allocated memory as
|
||||
* the given {ArrayBuffer}/{SharedArrayBuffer}.
|
||||
*
|
||||
*
|
||||
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
|
||||
*/
|
||||
constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer);
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
||||
*/
|
||||
constructor(array: any[]);
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
||||
*
|
||||
* @param buffer The buffer to copy.
|
||||
* @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
|
||||
*/
|
||||
constructor(buffer: Buffer);
|
||||
/**
|
||||
* When passed a reference to the .buffer property of a TypedArray instance,
|
||||
* the newly created Buffer will share the same allocated memory as the TypedArray.
|
||||
* The optional {byteOffset} and {length} arguments specify a memory range
|
||||
* within the {arrayBuffer} that will be shared by the Buffer.
|
||||
*
|
||||
* @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer()
|
||||
*/
|
||||
static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer using the passed {data}
|
||||
* @param data data to create a new Buffer
|
||||
*/
|
||||
static from(data: number[]): Buffer;
|
||||
static from(data: Uint8Array): Buffer;
|
||||
/**
|
||||
* Creates a new buffer containing the coerced value of an object
|
||||
* A `TypeError` will be thrown if {obj} has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants.
|
||||
* @param obj An object supporting `Symbol.toPrimitive` or `valueOf()`.
|
||||
*/
|
||||
static from(obj: { valueOf(): string | object } | { [Symbol.toPrimitive](hint: 'string'): string }, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
||||
* If provided, the {encoding} parameter identifies the character encoding.
|
||||
* If not provided, {encoding} defaults to 'utf8'.
|
||||
*/
|
||||
static from(str: string, encoding?: BufferEncoding): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer using the passed {data}
|
||||
* @param values to create a new Buffer
|
||||
*/
|
||||
static of(...items: number[]): Buffer;
|
||||
/**
|
||||
* Returns true if {obj} is a Buffer
|
||||
*
|
||||
* @param obj object to test.
|
||||
*/
|
||||
static isBuffer(obj: any): obj is Buffer;
|
||||
/**
|
||||
* Returns true if {encoding} is a valid encoding argument.
|
||||
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
||||
*
|
||||
* @param encoding string to test.
|
||||
*/
|
||||
static isEncoding(encoding: string): encoding is BufferEncoding;
|
||||
/**
|
||||
* Gives the actual byte length of a string. encoding defaults to 'utf8'.
|
||||
* This is not the same as String.prototype.length since that returns the number of characters in a string.
|
||||
*
|
||||
* @param string string to test.
|
||||
* @param encoding encoding used to evaluate (defaults to 'utf8')
|
||||
*/
|
||||
static byteLength(
|
||||
string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
|
||||
encoding?: BufferEncoding
|
||||
): number;
|
||||
/**
|
||||
* Returns a buffer which is the result of concatenating all the buffers in the list together.
|
||||
*
|
||||
* If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
|
||||
* If the list has exactly one item, then the first item of the list is returned.
|
||||
* If the list has more than one item, then a new Buffer is created.
|
||||
*
|
||||
* @param list An array of Buffer objects to concatenate
|
||||
* @param totalLength Total length of the buffers when concatenated.
|
||||
* If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
|
||||
*/
|
||||
static concat(list: Uint8Array[], totalLength?: number): Buffer;
|
||||
/**
|
||||
* The same as buf1.compare(buf2).
|
||||
*/
|
||||
static compare(buf1: Uint8Array, buf2: Uint8Array): number;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
* @param fill if specified, buffer will be initialized by calling buf.fill(fill).
|
||||
* If parameter is omitted, buffer will be filled with zeros.
|
||||
* @param encoding encoding used for call to buf.fill while initalizing
|
||||
*/
|
||||
static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
static allocUnsafe(size: number): Buffer;
|
||||
/**
|
||||
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
static allocUnsafeSlow(size: number): Buffer;
|
||||
/**
|
||||
* This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified.
|
||||
*/
|
||||
static poolSize: number;
|
||||
|
||||
write(string: string, encoding?: BufferEncoding): number;
|
||||
write(string: string, offset: number, encoding?: BufferEncoding): number;
|
||||
write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
|
||||
toString(encoding?: BufferEncoding, start?: number, end?: number): string;
|
||||
toJSON(): { type: 'Buffer'; data: number[] };
|
||||
equals(otherBuffer: Uint8Array): boolean;
|
||||
compare(
|
||||
otherBuffer: Uint8Array,
|
||||
targetStart?: number,
|
||||
targetEnd?: number,
|
||||
sourceStart?: number,
|
||||
sourceEnd?: number
|
||||
): number;
|
||||
copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
/**
|
||||
* Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
|
||||
*
|
||||
* This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory.
|
||||
*
|
||||
* @param begin Where the new `Buffer` will start. Default: `0`.
|
||||
* @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
|
||||
*/
|
||||
slice(begin?: number, end?: number): Buffer;
|
||||
/**
|
||||
* Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
|
||||
*
|
||||
* This method is compatible with `Uint8Array#subarray()`.
|
||||
*
|
||||
* @param begin Where the new `Buffer` will start. Default: `0`.
|
||||
* @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
|
||||
*/
|
||||
subarray(begin?: number, end?: number): Buffer;
|
||||
writeUIntLE(value: number, offset: number, byteLength: number): number;
|
||||
writeUIntBE(value: number, offset: number, byteLength: number): number;
|
||||
writeIntLE(value: number, offset: number, byteLength: number): number;
|
||||
writeIntBE(value: number, offset: number, byteLength: number): number;
|
||||
readUIntLE(offset: number, byteLength: number): number;
|
||||
readUIntBE(offset: number, byteLength: number): number;
|
||||
readIntLE(offset: number, byteLength: number): number;
|
||||
readIntBE(offset: number, byteLength: number): number;
|
||||
readUInt8(offset?: number): number;
|
||||
readUInt16LE(offset?: number): number;
|
||||
readUInt16BE(offset?: number): number;
|
||||
readUInt32LE(offset?: number): number;
|
||||
readUInt32BE(offset?: number): number;
|
||||
readInt8(offset?: number): number;
|
||||
readInt16LE(offset?: number): number;
|
||||
readInt16BE(offset?: number): number;
|
||||
readInt32LE(offset?: number): number;
|
||||
readInt32BE(offset?: number): number;
|
||||
readFloatLE(offset?: number): number;
|
||||
readFloatBE(offset?: number): number;
|
||||
readDoubleLE(offset?: number): number;
|
||||
readDoubleBE(offset?: number): number;
|
||||
reverse(): this;
|
||||
swap16(): Buffer;
|
||||
swap32(): Buffer;
|
||||
swap64(): Buffer;
|
||||
writeUInt8(value: number, offset?: number): number;
|
||||
writeUInt16LE(value: number, offset?: number): number;
|
||||
writeUInt16BE(value: number, offset?: number): number;
|
||||
writeUInt32LE(value: number, offset?: number): number;
|
||||
writeUInt32BE(value: number, offset?: number): number;
|
||||
writeInt8(value: number, offset?: number): number;
|
||||
writeInt16LE(value: number, offset?: number): number;
|
||||
writeInt16BE(value: number, offset?: number): number;
|
||||
writeInt32LE(value: number, offset?: number): number;
|
||||
writeInt32BE(value: number, offset?: number): number;
|
||||
writeFloatLE(value: number, offset?: number): number;
|
||||
writeFloatBE(value: number, offset?: number): number;
|
||||
writeDoubleLE(value: number, offset?: number): number;
|
||||
writeDoubleBE(value: number, offset?: number): number;
|
||||
|
||||
fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
|
||||
|
||||
indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
||||
lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
|
||||
keys(): IterableIterator<number>;
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
/*----------------------------------------------*
|
||||
* *
|
||||
* GLOBAL INTERFACES *
|
||||
* *
|
||||
*-----------------------------------------------*/
|
||||
declare namespace NodeJS {
|
||||
interface InspectOptions {
|
||||
/**
|
||||
* If set to `true`, getters are going to be
|
||||
* inspected as well. If set to `'get'` only getters without setter are going
|
||||
* to be inspected. If set to `'set'` only getters having a corresponding
|
||||
* setter are going to be inspected. This might cause side effects depending on
|
||||
* the getter function.
|
||||
* @default `false`
|
||||
*/
|
||||
getters?: 'get' | 'set' | boolean;
|
||||
showHidden?: boolean;
|
||||
/**
|
||||
* @default 2
|
||||
*/
|
||||
depth?: number | null;
|
||||
colors?: boolean;
|
||||
customInspect?: boolean;
|
||||
showProxy?: boolean;
|
||||
maxArrayLength?: number | null;
|
||||
/**
|
||||
* Specifies the maximum number of characters to
|
||||
* include when formatting. Set to `null` or `Infinity` to show all elements.
|
||||
* Set to `0` or negative to show no characters.
|
||||
* @default Infinity
|
||||
*/
|
||||
maxStringLength?: number | null;
|
||||
breakLength?: number;
|
||||
/**
|
||||
* Setting this to `false` causes each object key
|
||||
* to be displayed on a new line. It will also add new lines to text that is
|
||||
* longer than `breakLength`. If set to a number, the most `n` inner elements
|
||||
* are united on a single line as long as all properties fit into
|
||||
* `breakLength`. Short array elements are also grouped together. Note that no
|
||||
* text will be reduced below 16 characters, no matter the `breakLength` size.
|
||||
* For more information, see the example below.
|
||||
* @default `true`
|
||||
*/
|
||||
compact?: boolean | number;
|
||||
sorted?: boolean | ((a: string, b: string) => number);
|
||||
}
|
||||
|
||||
interface CallSite {
|
||||
/**
|
||||
* Value of "this"
|
||||
*/
|
||||
getThis(): any;
|
||||
|
||||
/**
|
||||
* Type of "this" as a string.
|
||||
* This is the name of the function stored in the constructor field of
|
||||
* "this", if available. Otherwise the object's [[Class]] internal
|
||||
* property.
|
||||
*/
|
||||
getTypeName(): string | null;
|
||||
|
||||
/**
|
||||
* Current function
|
||||
*/
|
||||
getFunction(): Function | undefined;
|
||||
|
||||
/**
|
||||
* Name of the current function, typically its name property.
|
||||
* If a name property is not available an attempt will be made to try
|
||||
* to infer a name from the function's context.
|
||||
*/
|
||||
getFunctionName(): string | null;
|
||||
|
||||
/**
|
||||
* Name of the property [of "this" or one of its prototypes] that holds
|
||||
* the current function
|
||||
*/
|
||||
getMethodName(): string | null;
|
||||
|
||||
/**
|
||||
* Name of the script [if this function was defined in a script]
|
||||
*/
|
||||
getFileName(): string | null;
|
||||
|
||||
/**
|
||||
* Current line number [if this function was defined in a script]
|
||||
*/
|
||||
getLineNumber(): number | null;
|
||||
|
||||
/**
|
||||
* Current column number [if this function was defined in a script]
|
||||
*/
|
||||
getColumnNumber(): number | null;
|
||||
|
||||
/**
|
||||
* A call site object representing the location where eval was called
|
||||
* [if this function was created using a call to eval]
|
||||
*/
|
||||
getEvalOrigin(): string | undefined;
|
||||
|
||||
/**
|
||||
* Is this a toplevel invocation, that is, is "this" the global object?
|
||||
*/
|
||||
isToplevel(): boolean;
|
||||
|
||||
/**
|
||||
* Does this call take place in code defined by a call to eval?
|
||||
*/
|
||||
isEval(): boolean;
|
||||
|
||||
/**
|
||||
* Is this call in native V8 code?
|
||||
*/
|
||||
isNative(): boolean;
|
||||
|
||||
/**
|
||||
* Is this a constructor call?
|
||||
*/
|
||||
isConstructor(): boolean;
|
||||
}
|
||||
|
||||
interface ErrnoException extends Error {
|
||||
errno?: number;
|
||||
code?: string;
|
||||
path?: string;
|
||||
syscall?: string;
|
||||
stack?: string;
|
||||
}
|
||||
|
||||
interface ReadableStream extends EventEmitter {
|
||||
readable: boolean;
|
||||
read(size?: number): string | Buffer;
|
||||
setEncoding(encoding: BufferEncoding): this;
|
||||
pause(): this;
|
||||
resume(): this;
|
||||
isPaused(): boolean;
|
||||
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe(destination?: WritableStream): this;
|
||||
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
||||
wrap(oldStream: ReadableStream): this;
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
|
||||
}
|
||||
|
||||
interface WritableStream extends EventEmitter {
|
||||
writable: boolean;
|
||||
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
||||
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
||||
end(cb?: () => void): void;
|
||||
end(data: string | Uint8Array, cb?: () => void): void;
|
||||
end(str: string, encoding?: BufferEncoding, cb?: () => void): void;
|
||||
}
|
||||
|
||||
interface ReadWriteStream extends ReadableStream, WritableStream { }
|
||||
|
||||
interface Global {
|
||||
Array: typeof Array;
|
||||
ArrayBuffer: typeof ArrayBuffer;
|
||||
Boolean: typeof Boolean;
|
||||
Buffer: typeof Buffer;
|
||||
DataView: typeof DataView;
|
||||
Date: typeof Date;
|
||||
Error: typeof Error;
|
||||
EvalError: typeof EvalError;
|
||||
Float32Array: typeof Float32Array;
|
||||
Float64Array: typeof Float64Array;
|
||||
Function: typeof Function;
|
||||
Infinity: typeof Infinity;
|
||||
Int16Array: typeof Int16Array;
|
||||
Int32Array: typeof Int32Array;
|
||||
Int8Array: typeof Int8Array;
|
||||
Intl: typeof Intl;
|
||||
JSON: typeof JSON;
|
||||
Map: MapConstructor;
|
||||
Math: typeof Math;
|
||||
NaN: typeof NaN;
|
||||
Number: typeof Number;
|
||||
Object: typeof Object;
|
||||
Promise: typeof Promise;
|
||||
RangeError: typeof RangeError;
|
||||
ReferenceError: typeof ReferenceError;
|
||||
RegExp: typeof RegExp;
|
||||
Set: SetConstructor;
|
||||
String: typeof String;
|
||||
Symbol: Function;
|
||||
SyntaxError: typeof SyntaxError;
|
||||
TypeError: typeof TypeError;
|
||||
URIError: typeof URIError;
|
||||
Uint16Array: typeof Uint16Array;
|
||||
Uint32Array: typeof Uint32Array;
|
||||
Uint8Array: typeof Uint8Array;
|
||||
Uint8ClampedArray: typeof Uint8ClampedArray;
|
||||
WeakMap: WeakMapConstructor;
|
||||
WeakSet: WeakSetConstructor;
|
||||
clearImmediate: (immediateId: Immediate) => void;
|
||||
clearInterval: (intervalId: Timeout) => void;
|
||||
clearTimeout: (timeoutId: Timeout) => void;
|
||||
decodeURI: typeof decodeURI;
|
||||
decodeURIComponent: typeof decodeURIComponent;
|
||||
encodeURI: typeof encodeURI;
|
||||
encodeURIComponent: typeof encodeURIComponent;
|
||||
escape: (str: string) => string;
|
||||
eval: typeof eval;
|
||||
global: Global;
|
||||
isFinite: typeof isFinite;
|
||||
isNaN: typeof isNaN;
|
||||
parseFloat: typeof parseFloat;
|
||||
parseInt: typeof parseInt;
|
||||
setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => Immediate;
|
||||
setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;
|
||||
setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;
|
||||
queueMicrotask: typeof queueMicrotask;
|
||||
undefined: typeof undefined;
|
||||
unescape: (str: string) => string;
|
||||
gc: () => void;
|
||||
v8debug?: any;
|
||||
}
|
||||
|
||||
interface RefCounted {
|
||||
ref(): this;
|
||||
unref(): this;
|
||||
}
|
||||
|
||||
// compatibility with older typings
|
||||
interface Timer extends RefCounted {
|
||||
hasRef(): boolean;
|
||||
refresh(): this;
|
||||
}
|
||||
|
||||
interface Immediate extends RefCounted {
|
||||
hasRef(): boolean;
|
||||
_onImmediate: Function; // to distinguish it from the Timeout class
|
||||
}
|
||||
|
||||
interface Timeout extends Timer {
|
||||
hasRef(): boolean;
|
||||
refresh(): this;
|
||||
}
|
||||
|
||||
type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
|
||||
type ArrayBufferView = TypedArray | DataView;
|
||||
|
||||
interface Require {
|
||||
/* tslint:disable-next-line:callable-types */
|
||||
(id: string): any;
|
||||
resolve: RequireResolve;
|
||||
cache: Dict<NodeModule>;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
extensions: RequireExtensions;
|
||||
main: Module | undefined;
|
||||
}
|
||||
|
||||
interface RequireResolve {
|
||||
(id: string, options?: { paths?: string[]; }): string;
|
||||
paths(request: string): string[] | null;
|
||||
}
|
||||
|
||||
interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
|
||||
'.js': (m: Module, filename: string) => any;
|
||||
'.json': (m: Module, filename: string) => any;
|
||||
'.node': (m: Module, filename: string) => any;
|
||||
}
|
||||
interface Module {
|
||||
exports: any;
|
||||
require: Require;
|
||||
id: string;
|
||||
filename: string;
|
||||
loaded: boolean;
|
||||
/** @deprecated since 14.6.0 Please use `require.main` and `module.children` instead. */
|
||||
parent: Module | null | undefined;
|
||||
children: Module[];
|
||||
/**
|
||||
* @since 11.14.0
|
||||
*
|
||||
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
|
||||
*/
|
||||
path: string;
|
||||
paths: string[];
|
||||
}
|
||||
|
||||
interface Dict<T> {
|
||||
[key: string]: T | undefined;
|
||||
}
|
||||
|
||||
interface ReadOnlyDict<T> {
|
||||
readonly [key: string]: T | undefined;
|
||||
}
|
||||
}
|
||||
44
types/node/ts3.1/index.d.ts
vendored
44
types/node/ts3.1/index.d.ts
vendored
@ -1,44 +0,0 @@
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.1.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.8
|
||||
// - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5
|
||||
|
||||
// NOTE: Augmentations for TypeScript 3.5 and later should use individual files for overrides
|
||||
// within the respective ~/ts3.5 (or later) folder. However, this is disallowed for versions
|
||||
// prior to TypeScript 3.5, so the older definitions will be found here.
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// We can't include globals.global.d.ts in globals.d.ts, as it'll cause duplication errors in TypeScript 3.5+
|
||||
/// <reference path="globals.global.d.ts" />
|
||||
|
||||
// We can't include assert.d.ts in base.d.ts, as it'll cause duplication errors in TypeScript 3.7+
|
||||
/// <reference path="assert.d.ts" />
|
||||
|
||||
// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
|
||||
// Empty interfaces are used here which merge fine with the real declarations in the lib XXX files
|
||||
// just to ensure the names are known and node typings can be used without importing these libs.
|
||||
// if someone really needs these types the libs need to be added via --lib or in tsconfig.json
|
||||
interface AsyncIterable<T> { }
|
||||
interface IterableIterator<T> { }
|
||||
interface AsyncIterableIterator<T> {}
|
||||
interface SymbolConstructor {
|
||||
readonly asyncIterator: symbol;
|
||||
}
|
||||
declare var Symbol: SymbolConstructor;
|
||||
// even this is just a forward declaration some properties are added otherwise
|
||||
// it would be allowed to pass anything to e.g. Buffer.from()
|
||||
interface SharedArrayBuffer {
|
||||
readonly byteLength: number;
|
||||
slice(begin?: number, end?: number): SharedArrayBuffer;
|
||||
}
|
||||
|
||||
declare module "util" {
|
||||
namespace types {
|
||||
function isBigInt64Array(value: any): boolean;
|
||||
function isBigUint64Array(value: any): boolean;
|
||||
}
|
||||
}
|
||||
@ -1,353 +0,0 @@
|
||||
import * as fs from "fs";
|
||||
import * as url from "url";
|
||||
import * as util from "util";
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
import * as net from "net";
|
||||
import * as console2 from "console";
|
||||
import * as timers from "timers";
|
||||
import * as inspector from "inspector";
|
||||
import * as trace_events from "trace_events";
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
/// Https tests : http://nodejs.org/api/https.html ///
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
let agent: https.Agent = new https.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 10000,
|
||||
maxSockets: Infinity,
|
||||
maxFreeSockets: 256,
|
||||
maxCachedSessions: 100,
|
||||
timeout: 15000
|
||||
});
|
||||
|
||||
agent = https.globalAgent;
|
||||
|
||||
let sockets: NodeJS.ReadOnlyDict<net.Socket[]> = agent.sockets;
|
||||
sockets = agent.freeSockets;
|
||||
|
||||
https.request({
|
||||
agent: false
|
||||
});
|
||||
https.request({
|
||||
agent
|
||||
});
|
||||
https.request({
|
||||
agent: undefined
|
||||
});
|
||||
|
||||
https.get('http://www.example.com/xyz');
|
||||
https.request('http://www.example.com/xyz');
|
||||
|
||||
https.get('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
https.request('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'));
|
||||
https.request(new url.URL('http://www.example.com/xyz'));
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
|
||||
const opts: https.RequestOptions = {
|
||||
path: '/some/path'
|
||||
};
|
||||
https.get(new url.URL('http://www.example.com'), opts);
|
||||
https.request(new url.URL('http://www.example.com'), opts);
|
||||
https.get(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.globalAgent.options.ca = [];
|
||||
|
||||
{
|
||||
function reqListener(req: http.IncomingMessage, res: http.ServerResponse): void {}
|
||||
|
||||
class MyIncomingMessage extends http.IncomingMessage {
|
||||
foo: number;
|
||||
}
|
||||
|
||||
class MyServerResponse extends http.ServerResponse {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
let server: https.Server;
|
||||
|
||||
server = new https.Server();
|
||||
server = new https.Server(reqListener);
|
||||
server = new https.Server({ IncomingMessage: MyIncomingMessage});
|
||||
|
||||
server = new https.Server({
|
||||
IncomingMessage: MyIncomingMessage,
|
||||
ServerResponse: MyServerResponse
|
||||
}, reqListener);
|
||||
|
||||
server = https.createServer();
|
||||
server = https.createServer(reqListener);
|
||||
server = https.createServer({ IncomingMessage: MyIncomingMessage });
|
||||
server = https.createServer({ ServerResponse: MyServerResponse }, reqListener);
|
||||
|
||||
const timeout: number = server.timeout;
|
||||
const listening: boolean = server.listening;
|
||||
const keepAliveTimeout: number = server.keepAliveTimeout;
|
||||
const maxHeadersCount: number | null = server.maxHeadersCount;
|
||||
const headersTimeout: number = server.headersTimeout;
|
||||
server.setTimeout().setTimeout(1000).setTimeout(() => {}).setTimeout(100, () => {});
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/// Timers tests : https://nodejs.org/api/timers.html
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const immediate = timers
|
||||
.setImmediate(() => {
|
||||
console.log('immediate');
|
||||
})
|
||||
.unref()
|
||||
.ref();
|
||||
const b: boolean = immediate.hasRef();
|
||||
timers.clearImmediate(immediate);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setInterval(() => {
|
||||
console.log('interval');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearInterval(timeout);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setTimeout(() => {
|
||||
console.log('timeout');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearTimeout(timeout);
|
||||
}
|
||||
async function testPromisify(doSomething: {
|
||||
(foo: any, onSuccessCallback: (result: string) => void, onErrorCallback: (reason: any) => void): void;
|
||||
[util.promisify.custom](foo: any): Promise<string>;
|
||||
}) {
|
||||
const setTimeout = util.promisify(timers.setTimeout);
|
||||
let v: void = await setTimeout(100); // tslint:disable-line no-void-expression void-return
|
||||
let s: string = await setTimeout(100, "");
|
||||
|
||||
const setImmediate = util.promisify(timers.setImmediate);
|
||||
v = await setImmediate(); // tslint:disable-line no-void-expression
|
||||
s = await setImmediate("");
|
||||
|
||||
// $ExpectType (foo: any) => Promise<string>
|
||||
const doSomethingPromise = util.promisify(doSomething);
|
||||
|
||||
// $ExpectType string
|
||||
s = await doSomethingPromise('foo');
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
/// Errors Tests : https://nodejs.org/api/errors.html ///
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
Error.stackTraceLimit = Infinity;
|
||||
}
|
||||
{
|
||||
const myObject = {};
|
||||
Error.captureStackTrace(myObject);
|
||||
}
|
||||
{
|
||||
const frames: NodeJS.CallSite[] = [];
|
||||
Error.prepareStackTrace!(new Error(), frames);
|
||||
}
|
||||
{
|
||||
const frame: NodeJS.CallSite = null!;
|
||||
const frameThis: any = frame.getThis();
|
||||
const typeName: string | null = frame.getTypeName();
|
||||
const func: Function | undefined = frame.getFunction();
|
||||
const funcName: string | null = frame.getFunctionName();
|
||||
const meth: string | null = frame.getMethodName();
|
||||
const fname: string | null = frame.getFileName();
|
||||
const lineno: number | null = frame.getLineNumber();
|
||||
const colno: number | null = frame.getColumnNumber();
|
||||
const evalOrigin: string | undefined = frame.getEvalOrigin();
|
||||
const isTop: boolean = frame.isToplevel();
|
||||
const isEval: boolean = frame.isEval();
|
||||
const isNative: boolean = frame.isNative();
|
||||
const isConstr: boolean = frame.isConstructor();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Console Tests : https://nodejs.org/api/console.html ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
let _c: Console = console;
|
||||
_c = console2;
|
||||
}
|
||||
{
|
||||
const writeStream = fs.createWriteStream('./index.d.ts');
|
||||
let consoleInstance: Console = new console.Console(writeStream);
|
||||
|
||||
consoleInstance = new console.Console(writeStream, writeStream);
|
||||
consoleInstance = new console.Console(writeStream, writeStream, true);
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
stderr: writeStream,
|
||||
colorMode: 'auto',
|
||||
ignoreErrors: true
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
colorMode: false
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream
|
||||
});
|
||||
}
|
||||
{
|
||||
console.assert('value');
|
||||
console.assert('value', 'message');
|
||||
console.assert('value', 'message', 'foo', 'bar');
|
||||
console.clear();
|
||||
console.count();
|
||||
console.count('label');
|
||||
console.countReset();
|
||||
console.countReset('label');
|
||||
console.debug();
|
||||
console.debug('message');
|
||||
console.debug('message', 'foo', 'bar');
|
||||
console.dir('obj');
|
||||
console.dir('obj', { depth: 1 });
|
||||
console.error();
|
||||
console.error('message');
|
||||
console.error('message', 'foo', 'bar');
|
||||
console.group();
|
||||
console.group('label');
|
||||
console.group('label1', 'label2');
|
||||
console.groupCollapsed();
|
||||
console.groupEnd();
|
||||
console.info();
|
||||
console.info('message');
|
||||
console.info('message', 'foo', 'bar');
|
||||
console.log();
|
||||
console.log('message');
|
||||
console.log('message', 'foo', 'bar');
|
||||
console.table({ foo: 'bar' });
|
||||
console.table([{ foo: 'bar' }]);
|
||||
console.table([{ foo: 'bar' }], ['foo']);
|
||||
console.time();
|
||||
console.time('label');
|
||||
console.timeEnd();
|
||||
console.timeEnd('label');
|
||||
console.timeLog();
|
||||
console.timeLog('label');
|
||||
console.timeLog('label', 'foo', 'bar');
|
||||
console.trace();
|
||||
console.trace('message');
|
||||
console.trace('message', 'foo', 'bar');
|
||||
console.warn();
|
||||
console.warn('message');
|
||||
console.warn('message', 'foo', 'bar');
|
||||
|
||||
// --- Inspector mode only ---
|
||||
console.profile();
|
||||
console.profile('label');
|
||||
console.profileEnd();
|
||||
console.profileEnd('label');
|
||||
console.timeStamp();
|
||||
console.timeStamp('label');
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* The following tests are the modules not mentioned in document but existed *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Inspector Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const b: inspector.Console.ConsoleMessage = {source: 'test', text: 'test', level: 'error' };
|
||||
inspector.open();
|
||||
inspector.open(0);
|
||||
inspector.open(0, 'localhost');
|
||||
inspector.open(0, 'localhost', true);
|
||||
inspector.close();
|
||||
const inspectorUrl: string | undefined = inspector.url();
|
||||
|
||||
const session = new inspector.Session();
|
||||
session.connect();
|
||||
session.disconnect();
|
||||
|
||||
// Unknown post method
|
||||
session.post('A.b', { key: 'value' }, (err, params) => {});
|
||||
// TODO: parameters are implicitly 'any' and need type annotation
|
||||
session.post('A.b', (err: Error | null, params?: {}) => {});
|
||||
session.post('A.b');
|
||||
// Known post method
|
||||
const parameter: inspector.Runtime.EvaluateParameterType = { expression: '2 + 2' };
|
||||
session.post('Runtime.evaluate', parameter,
|
||||
(err: Error | null, params: inspector.Runtime.EvaluateReturnType) => {});
|
||||
session.post('Runtime.evaluate', (err: Error, params: inspector.Runtime.EvaluateReturnType) => {
|
||||
const exceptionDetails: inspector.Runtime.ExceptionDetails = params.exceptionDetails!;
|
||||
const resultClassName: string = params.result.className!;
|
||||
});
|
||||
session.post('Runtime.evaluate');
|
||||
|
||||
// General event
|
||||
session.on('inspectorNotification', message => {
|
||||
message; // $ExpectType InspectorNotification<{}>
|
||||
});
|
||||
// Known events
|
||||
session.on('Debugger.paused', (message: inspector.InspectorNotification<inspector.Debugger.PausedEventDataType>) => {
|
||||
const method: string = message.method;
|
||||
const pauseReason: string = message.params.reason;
|
||||
});
|
||||
session.on('Debugger.resumed', () => {});
|
||||
// Node Inspector events
|
||||
session.on('NodeTracing.dataCollected', (message: inspector.InspectorNotification<inspector.NodeTracing.DataCollectedEventDataType>) => {
|
||||
const value: Array<{}> = message.params.value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Trace Events Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const enabledCategories: string | undefined = trace_events.getEnabledCategories();
|
||||
const tracing: trace_events.Tracing = trace_events.createTracing({ categories: ['node', 'v8'] });
|
||||
const categories: string = tracing.categories;
|
||||
const enabled: boolean = tracing.enabled;
|
||||
tracing.enable();
|
||||
tracing.disable();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Node.js ESNEXT Support
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const s = 'foo';
|
||||
const s1: string = s.trimLeft();
|
||||
const s2: string = s.trimRight();
|
||||
const s3: string = s.trimStart();
|
||||
const s4: string = s.trimEnd();
|
||||
}
|
||||
405
types/node/ts3.1/process.d.ts
vendored
405
types/node/ts3.1/process.d.ts
vendored
@ -1,405 +0,0 @@
|
||||
declare module "process" {
|
||||
import * as tty from "tty";
|
||||
|
||||
global {
|
||||
var process: NodeJS.Process;
|
||||
|
||||
namespace NodeJS {
|
||||
// this namespace merge is here because these are specifically used
|
||||
// as the type for process.stdin, process.stdout, and process.stderr.
|
||||
// they can't live in tty.d.ts because we need to disambiguate the imported name.
|
||||
interface ReadStream extends tty.ReadStream {}
|
||||
interface WriteStream extends tty.WriteStream {}
|
||||
|
||||
interface MemoryUsage {
|
||||
rss: number;
|
||||
heapTotal: number;
|
||||
heapUsed: number;
|
||||
external: number;
|
||||
arrayBuffers: number;
|
||||
}
|
||||
|
||||
interface CpuUsage {
|
||||
user: number;
|
||||
system: number;
|
||||
}
|
||||
|
||||
interface ProcessRelease {
|
||||
name: string;
|
||||
sourceUrl?: string;
|
||||
headersUrl?: string;
|
||||
libUrl?: string;
|
||||
lts?: string;
|
||||
}
|
||||
|
||||
interface ProcessVersions extends Dict<string> {
|
||||
http_parser: string;
|
||||
node: string;
|
||||
v8: string;
|
||||
ares: string;
|
||||
uv: string;
|
||||
zlib: string;
|
||||
modules: string;
|
||||
openssl: string;
|
||||
}
|
||||
|
||||
type Platform = 'aix'
|
||||
| 'android'
|
||||
| 'darwin'
|
||||
| 'freebsd'
|
||||
| 'linux'
|
||||
| 'openbsd'
|
||||
| 'sunos'
|
||||
| 'win32'
|
||||
| 'cygwin'
|
||||
| 'netbsd';
|
||||
|
||||
type Signals =
|
||||
"SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" |
|
||||
"SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" |
|
||||
"SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" |
|
||||
"SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
|
||||
|
||||
type MultipleResolveType = 'resolve' | 'reject';
|
||||
|
||||
type BeforeExitListener = (code: number) => void;
|
||||
type DisconnectListener = () => void;
|
||||
type ExitListener = (code: number) => void;
|
||||
type RejectionHandledListener = (promise: Promise<any>) => void;
|
||||
type UncaughtExceptionListener = (error: Error) => void;
|
||||
type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<any>) => void;
|
||||
type WarningListener = (warning: Error) => void;
|
||||
type MessageListener = (message: any, sendHandle: any) => void;
|
||||
type SignalsListener = (signal: Signals) => void;
|
||||
type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
|
||||
type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
|
||||
type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<any>, value: any) => void;
|
||||
|
||||
interface Socket extends ReadWriteStream {
|
||||
isTTY?: true;
|
||||
}
|
||||
|
||||
// Alias for compatibility
|
||||
interface ProcessEnv extends Dict<string> {}
|
||||
|
||||
interface HRTime {
|
||||
(time?: [number, number]): [number, number];
|
||||
}
|
||||
|
||||
interface ProcessReport {
|
||||
/**
|
||||
* Directory where the report is written.
|
||||
* working directory of the Node.js process.
|
||||
* @default '' indicating that reports are written to the current
|
||||
*/
|
||||
directory: string;
|
||||
|
||||
/**
|
||||
* Filename where the report is written.
|
||||
* The default value is the empty string.
|
||||
* @default '' the output filename will be comprised of a timestamp,
|
||||
* PID, and sequence number.
|
||||
*/
|
||||
filename: string;
|
||||
|
||||
/**
|
||||
* Returns a JSON-formatted diagnostic report for the running process.
|
||||
* The report's JavaScript stack trace is taken from err, if present.
|
||||
*/
|
||||
getReport(err?: Error): string;
|
||||
|
||||
/**
|
||||
* If true, a diagnostic report is generated on fatal errors,
|
||||
* such as out of memory errors or failed C++ assertions.
|
||||
* @default false
|
||||
*/
|
||||
reportOnFatalError: boolean;
|
||||
|
||||
/**
|
||||
* If true, a diagnostic report is generated when the process
|
||||
* receives the signal specified by process.report.signal.
|
||||
* @defaul false
|
||||
*/
|
||||
reportOnSignal: boolean;
|
||||
|
||||
/**
|
||||
* If true, a diagnostic report is generated on uncaught exception.
|
||||
* @default false
|
||||
*/
|
||||
reportOnUncaughtException: boolean;
|
||||
|
||||
/**
|
||||
* The signal used to trigger the creation of a diagnostic report.
|
||||
* @default 'SIGUSR2'
|
||||
*/
|
||||
signal: Signals;
|
||||
|
||||
/**
|
||||
* Writes a diagnostic report to a file. If filename is not provided, the default filename
|
||||
* includes the date, time, PID, and a sequence number.
|
||||
* The report's JavaScript stack trace is taken from err, if present.
|
||||
*
|
||||
* @param fileName Name of the file where the report is written.
|
||||
* This should be a relative path, that will be appended to the directory specified in
|
||||
* `process.report.directory`, or the current working directory of the Node.js process,
|
||||
* if unspecified.
|
||||
* @param error A custom error used for reporting the JavaScript stack.
|
||||
* @return Filename of the generated report.
|
||||
*/
|
||||
writeReport(fileName?: string): string;
|
||||
writeReport(error?: Error): string;
|
||||
writeReport(fileName?: string, err?: Error): string;
|
||||
}
|
||||
|
||||
interface ResourceUsage {
|
||||
fsRead: number;
|
||||
fsWrite: number;
|
||||
involuntaryContextSwitches: number;
|
||||
ipcReceived: number;
|
||||
ipcSent: number;
|
||||
majorPageFault: number;
|
||||
maxRSS: number;
|
||||
minorPageFault: number;
|
||||
sharedMemorySize: number;
|
||||
signalsCount: number;
|
||||
swappedOut: number;
|
||||
systemCPUTime: number;
|
||||
unsharedDataSize: number;
|
||||
unsharedStackSize: number;
|
||||
userCPUTime: number;
|
||||
voluntaryContextSwitches: number;
|
||||
}
|
||||
|
||||
interface Process extends EventEmitter {
|
||||
/**
|
||||
* Can also be a tty.WriteStream, not typed due to limitations.
|
||||
*/
|
||||
stdout: WriteStream & {
|
||||
fd: 1;
|
||||
};
|
||||
/**
|
||||
* Can also be a tty.WriteStream, not typed due to limitations.
|
||||
*/
|
||||
stderr: WriteStream & {
|
||||
fd: 2;
|
||||
};
|
||||
stdin: ReadStream & {
|
||||
fd: 0;
|
||||
};
|
||||
openStdin(): Socket;
|
||||
argv: string[];
|
||||
argv0: string;
|
||||
execArgv: string[];
|
||||
execPath: string;
|
||||
abort(): void;
|
||||
chdir(directory: string): void;
|
||||
cwd(): string;
|
||||
debugPort: number;
|
||||
emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
|
||||
env: ProcessEnv;
|
||||
exit(code?: number): never;
|
||||
exitCode?: number;
|
||||
getgid(): number;
|
||||
setgid(id: number | string): void;
|
||||
getuid(): number;
|
||||
setuid(id: number | string): void;
|
||||
geteuid(): number;
|
||||
seteuid(id: number | string): void;
|
||||
getegid(): number;
|
||||
setegid(id: number | string): void;
|
||||
getgroups(): number[];
|
||||
setgroups(groups: Array<string | number>): void;
|
||||
setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
|
||||
hasUncaughtExceptionCaptureCallback(): boolean;
|
||||
version: string;
|
||||
versions: ProcessVersions;
|
||||
config: {
|
||||
target_defaults: {
|
||||
cflags: any[];
|
||||
default_configuration: string;
|
||||
defines: string[];
|
||||
include_dirs: string[];
|
||||
libraries: string[];
|
||||
};
|
||||
variables: {
|
||||
clang: number;
|
||||
host_arch: string;
|
||||
node_install_npm: boolean;
|
||||
node_install_waf: boolean;
|
||||
node_prefix: string;
|
||||
node_shared_openssl: boolean;
|
||||
node_shared_v8: boolean;
|
||||
node_shared_zlib: boolean;
|
||||
node_use_dtrace: boolean;
|
||||
node_use_etw: boolean;
|
||||
node_use_openssl: boolean;
|
||||
target_arch: string;
|
||||
v8_no_strict_aliasing: number;
|
||||
v8_use_snapshot: boolean;
|
||||
visibility: string;
|
||||
};
|
||||
};
|
||||
kill(pid: number, signal?: string | number): true;
|
||||
pid: number;
|
||||
ppid: number;
|
||||
title: string;
|
||||
arch: string;
|
||||
platform: Platform;
|
||||
/** @deprecated since v14.0.0 - use `require.main` instead. */
|
||||
mainModule?: Module;
|
||||
memoryUsage(): MemoryUsage;
|
||||
cpuUsage(previousValue?: CpuUsage): CpuUsage;
|
||||
nextTick(callback: Function, ...args: any[]): void;
|
||||
release: ProcessRelease;
|
||||
features: {
|
||||
inspector: boolean;
|
||||
debug: boolean;
|
||||
uv: boolean;
|
||||
ipv6: boolean;
|
||||
tls_alpn: boolean;
|
||||
tls_sni: boolean;
|
||||
tls_ocsp: boolean;
|
||||
tls: boolean;
|
||||
};
|
||||
/**
|
||||
* @deprecated since v14.0.0 - Calling process.umask() with no argument causes
|
||||
* the process-wide umask to be written twice. This introduces a race condition between threads,
|
||||
* and is a potential security vulnerability. There is no safe, cross-platform alternative API.
|
||||
*/
|
||||
umask(): number;
|
||||
/**
|
||||
* Can only be set if not in worker thread.
|
||||
*/
|
||||
umask(mask: number): number;
|
||||
uptime(): number;
|
||||
hrtime: HRTime;
|
||||
domain: Domain;
|
||||
|
||||
// Worker
|
||||
send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean;
|
||||
disconnect(): void;
|
||||
connected: boolean;
|
||||
|
||||
/**
|
||||
* The `process.allowedNodeEnvironmentFlags` property is a special,
|
||||
* read-only `Set` of flags allowable within the [`NODE_OPTIONS`][]
|
||||
* environment variable.
|
||||
*/
|
||||
allowedNodeEnvironmentFlags: ReadonlySet<string>;
|
||||
|
||||
/**
|
||||
* Only available with `--experimental-report`
|
||||
*/
|
||||
report?: ProcessReport;
|
||||
|
||||
resourceUsage(): ResourceUsage;
|
||||
|
||||
/* EventEmitter */
|
||||
addListener(event: "beforeExit", listener: BeforeExitListener): this;
|
||||
addListener(event: "disconnect", listener: DisconnectListener): this;
|
||||
addListener(event: "exit", listener: ExitListener): this;
|
||||
addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
||||
addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
||||
addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
|
||||
addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
||||
addListener(event: "warning", listener: WarningListener): this;
|
||||
addListener(event: "message", listener: MessageListener): this;
|
||||
addListener(event: Signals, listener: SignalsListener): this;
|
||||
addListener(event: "newListener", listener: NewListenerListener): this;
|
||||
addListener(event: "removeListener", listener: RemoveListenerListener): this;
|
||||
addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
|
||||
emit(event: "beforeExit", code: number): boolean;
|
||||
emit(event: "disconnect"): boolean;
|
||||
emit(event: "exit", code: number): boolean;
|
||||
emit(event: "rejectionHandled", promise: Promise<any>): boolean;
|
||||
emit(event: "uncaughtException", error: Error): boolean;
|
||||
emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
|
||||
emit(event: "unhandledRejection", reason: any, promise: Promise<any>): boolean;
|
||||
emit(event: "warning", warning: Error): boolean;
|
||||
emit(event: "message", message: any, sendHandle: any): this;
|
||||
emit(event: Signals, signal: Signals): boolean;
|
||||
emit(event: "newListener", eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||
emit(event: "removeListener", eventName: string, listener: (...args: any[]) => void): this;
|
||||
emit(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
|
||||
on(event: "beforeExit", listener: BeforeExitListener): this;
|
||||
on(event: "disconnect", listener: DisconnectListener): this;
|
||||
on(event: "exit", listener: ExitListener): this;
|
||||
on(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
||||
on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
||||
on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
|
||||
on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
||||
on(event: "warning", listener: WarningListener): this;
|
||||
on(event: "message", listener: MessageListener): this;
|
||||
on(event: Signals, listener: SignalsListener): this;
|
||||
on(event: "newListener", listener: NewListenerListener): this;
|
||||
on(event: "removeListener", listener: RemoveListenerListener): this;
|
||||
on(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: "beforeExit", listener: BeforeExitListener): this;
|
||||
once(event: "disconnect", listener: DisconnectListener): this;
|
||||
once(event: "exit", listener: ExitListener): this;
|
||||
once(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
||||
once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
||||
once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
|
||||
once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
||||
once(event: "warning", listener: WarningListener): this;
|
||||
once(event: "message", listener: MessageListener): this;
|
||||
once(event: Signals, listener: SignalsListener): this;
|
||||
once(event: "newListener", listener: NewListenerListener): this;
|
||||
once(event: "removeListener", listener: RemoveListenerListener): this;
|
||||
once(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
|
||||
prependListener(event: "beforeExit", listener: BeforeExitListener): this;
|
||||
prependListener(event: "disconnect", listener: DisconnectListener): this;
|
||||
prependListener(event: "exit", listener: ExitListener): this;
|
||||
prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
||||
prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
||||
prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
|
||||
prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
||||
prependListener(event: "warning", listener: WarningListener): this;
|
||||
prependListener(event: "message", listener: MessageListener): this;
|
||||
prependListener(event: Signals, listener: SignalsListener): this;
|
||||
prependListener(event: "newListener", listener: NewListenerListener): this;
|
||||
prependListener(event: "removeListener", listener: RemoveListenerListener): this;
|
||||
prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
|
||||
prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
|
||||
prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
|
||||
prependOnceListener(event: "exit", listener: ExitListener): this;
|
||||
prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
||||
prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
||||
prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
|
||||
prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
||||
prependOnceListener(event: "warning", listener: WarningListener): this;
|
||||
prependOnceListener(event: "message", listener: MessageListener): this;
|
||||
prependOnceListener(event: Signals, listener: SignalsListener): this;
|
||||
prependOnceListener(event: "newListener", listener: NewListenerListener): this;
|
||||
prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this;
|
||||
prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
||||
|
||||
listeners(event: "beforeExit"): BeforeExitListener[];
|
||||
listeners(event: "disconnect"): DisconnectListener[];
|
||||
listeners(event: "exit"): ExitListener[];
|
||||
listeners(event: "rejectionHandled"): RejectionHandledListener[];
|
||||
listeners(event: "uncaughtException"): UncaughtExceptionListener[];
|
||||
listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[];
|
||||
listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
|
||||
listeners(event: "warning"): WarningListener[];
|
||||
listeners(event: "message"): MessageListener[];
|
||||
listeners(event: Signals): SignalsListener[];
|
||||
listeners(event: "newListener"): NewListenerListener[];
|
||||
listeners(event: "removeListener"): RemoveListenerListener[];
|
||||
listeners(event: "multipleResolves"): MultipleResolveListener[];
|
||||
}
|
||||
|
||||
interface Global {
|
||||
process: Process;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = process;
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "esnext",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"no-bad-reference": false,
|
||||
"no-empty-interface": false,
|
||||
"no-single-declare-module": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
194
types/node/ts3.1/util.d.ts
vendored
194
types/node/ts3.1/util.d.ts
vendored
@ -1,194 +0,0 @@
|
||||
declare module "util" {
|
||||
interface InspectOptions extends NodeJS.InspectOptions { }
|
||||
type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module';
|
||||
type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string;
|
||||
interface InspectOptionsStylized extends InspectOptions {
|
||||
stylize(text: string, styleType: Style): string;
|
||||
}
|
||||
function format(format: any, ...param: any[]): string;
|
||||
function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
|
||||
/** @deprecated since v0.11.3 - use a third party module instead. */
|
||||
function log(string: string): void;
|
||||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
function inspect(object: any, options: InspectOptions): string;
|
||||
namespace inspect {
|
||||
let colors: NodeJS.Dict<[number, number]>;
|
||||
let styles: {
|
||||
[K in Style]: string
|
||||
};
|
||||
let defaultOptions: InspectOptions;
|
||||
/**
|
||||
* Allows changing inspect settings from the repl.
|
||||
*/
|
||||
let replDefaults: InspectOptions;
|
||||
const custom: unique symbol;
|
||||
}
|
||||
/** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
|
||||
function isArray(object: any): object is any[];
|
||||
/** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
|
||||
function isDate(object: any): object is Date;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
|
||||
function isError(object: any): object is Error;
|
||||
function inherits(constructor: any, superConstructor: any): void;
|
||||
function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
|
||||
function isBoolean(object: any): object is boolean;
|
||||
/** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
|
||||
function isBuffer(object: any): object is Buffer;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
|
||||
function isFunction(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `value === null` instead. */
|
||||
function isNull(object: any): object is null;
|
||||
/** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
|
||||
function isNullOrUndefined(object: any): object is null | undefined;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
|
||||
function isNumber(object: any): object is number;
|
||||
/** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
|
||||
function isObject(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
|
||||
function isPrimitive(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
|
||||
function isString(object: any): object is string;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
|
||||
function isSymbol(object: any): object is symbol;
|
||||
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
|
||||
function isUndefined(object: any): object is undefined;
|
||||
function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
|
||||
function isDeepStrictEqual(val1: any, val2: any): boolean;
|
||||
|
||||
function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
|
||||
interface CustomPromisifyLegacy<TCustom extends Function> extends Function {
|
||||
__promisify__: TCustom;
|
||||
}
|
||||
|
||||
interface CustomPromisifySymbol<TCustom extends Function> extends Function {
|
||||
[promisify.custom]: TCustom;
|
||||
}
|
||||
|
||||
type CustomPromisify<TCustom extends Function> = CustomPromisifySymbol<TCustom> | CustomPromisifyLegacy<TCustom>;
|
||||
|
||||
function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
||||
function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
|
||||
function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
||||
function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
||||
function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
||||
function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
||||
function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
||||
function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
function promisify(fn: Function): Function;
|
||||
namespace promisify {
|
||||
const custom: unique symbol;
|
||||
}
|
||||
|
||||
namespace types {
|
||||
function isAnyArrayBuffer(object: any): boolean;
|
||||
function isArgumentsObject(object: any): object is IArguments;
|
||||
function isArrayBuffer(object: any): object is ArrayBuffer;
|
||||
function isArrayBufferView(object: any): object is ArrayBufferView;
|
||||
function isAsyncFunction(object: any): boolean;
|
||||
function isBooleanObject(object: any): object is Boolean;
|
||||
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
|
||||
function isDataView(object: any): object is DataView;
|
||||
function isDate(object: any): object is Date;
|
||||
function isExternal(object: any): boolean;
|
||||
function isFloat32Array(object: any): object is Float32Array;
|
||||
function isFloat64Array(object: any): object is Float64Array;
|
||||
function isGeneratorFunction(object: any): boolean;
|
||||
function isGeneratorObject(object: any): boolean;
|
||||
function isInt8Array(object: any): object is Int8Array;
|
||||
function isInt16Array(object: any): object is Int16Array;
|
||||
function isInt32Array(object: any): object is Int32Array;
|
||||
function isMap(object: any): boolean;
|
||||
function isMapIterator(object: any): boolean;
|
||||
function isModuleNamespaceObject(value: any): boolean;
|
||||
function isNativeError(object: any): object is Error;
|
||||
function isNumberObject(object: any): object is Number;
|
||||
function isPromise(object: any): boolean;
|
||||
function isProxy(object: any): boolean;
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
function isSet(object: any): boolean;
|
||||
function isSetIterator(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): boolean;
|
||||
function isStringObject(object: any): boolean;
|
||||
function isSymbolObject(object: any): boolean;
|
||||
function isTypedArray(object: any): object is NodeJS.TypedArray;
|
||||
function isUint8Array(object: any): object is Uint8Array;
|
||||
function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
||||
function isUint16Array(object: any): object is Uint16Array;
|
||||
function isUint32Array(object: any): object is Uint32Array;
|
||||
function isWeakMap(object: any): boolean;
|
||||
function isWeakSet(object: any): boolean;
|
||||
function isWebAssemblyCompiledModule(object: any): boolean;
|
||||
}
|
||||
|
||||
class TextDecoder {
|
||||
readonly encoding: string;
|
||||
readonly fatal: boolean;
|
||||
readonly ignoreBOM: boolean;
|
||||
constructor(
|
||||
encoding?: string,
|
||||
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
||||
);
|
||||
decode(
|
||||
input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
||||
options?: { stream?: boolean }
|
||||
): string;
|
||||
}
|
||||
|
||||
interface EncodeIntoResult {
|
||||
/**
|
||||
* The read Unicode code units of input.
|
||||
*/
|
||||
|
||||
read: number;
|
||||
/**
|
||||
* The written UTF-8 bytes of output.
|
||||
*/
|
||||
written: number;
|
||||
}
|
||||
|
||||
class TextEncoder {
|
||||
readonly encoding: string;
|
||||
encode(input?: string): Uint8Array;
|
||||
encodeInto(input: string, output: Uint8Array): EncodeIntoResult;
|
||||
}
|
||||
}
|
||||
45
types/node/ts3.4/base.d.ts
vendored
45
types/node/ts3.4/base.d.ts
vendored
@ -13,11 +13,44 @@
|
||||
/// <reference lib="esnext.bigint" />
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/base.d.ts" />
|
||||
|
||||
// TypeScript 3.2-specific augmentations:
|
||||
/// <reference path="../fs.d.ts" />
|
||||
/// <reference path="../process.d.ts" />
|
||||
/// <reference path="../util.d.ts" />
|
||||
/// <reference path="../globals.d.ts" />
|
||||
/// <reference path="../async_hooks.d.ts" />
|
||||
/// <reference path="../buffer.d.ts" />
|
||||
/// <reference path="../child_process.d.ts" />
|
||||
/// <reference path="../cluster.d.ts" />
|
||||
/// <reference path="../console.d.ts" />
|
||||
/// <reference path="../constants.d.ts" />
|
||||
/// <reference path="../crypto.d.ts" />
|
||||
/// <reference path="../dgram.d.ts" />
|
||||
/// <reference path="../dns.d.ts" />
|
||||
/// <reference path="../domain.d.ts" />
|
||||
/// <reference path="../events.d.ts" />
|
||||
/// <reference path="../fs.d.ts" />
|
||||
/// <reference path="../fs/promises.d.ts" />
|
||||
/// <reference path="../http.d.ts" />
|
||||
/// <reference path="../http2.d.ts" />
|
||||
/// <reference path="../https.d.ts" />
|
||||
/// <reference path="../inspector.d.ts" />
|
||||
/// <reference path="../module.d.ts" />
|
||||
/// <reference path="../net.d.ts" />
|
||||
/// <reference path="../os.d.ts" />
|
||||
/// <reference path="../path.d.ts" />
|
||||
/// <reference path="../perf_hooks.d.ts" />
|
||||
/// <reference path="../process.d.ts" />
|
||||
/// <reference path="../punycode.d.ts" />
|
||||
/// <reference path="../querystring.d.ts" />
|
||||
/// <reference path="../readline.d.ts" />
|
||||
/// <reference path="../repl.d.ts" />
|
||||
/// <reference path="../stream.d.ts" />
|
||||
/// <reference path="../string_decoder.d.ts" />
|
||||
/// <reference path="../timers.d.ts" />
|
||||
/// <reference path="../tls.d.ts" />
|
||||
/// <reference path="../trace_events.d.ts" />
|
||||
/// <reference path="../tty.d.ts" />
|
||||
/// <reference path="../url.d.ts" />
|
||||
/// <reference path="../util.d.ts" />
|
||||
/// <reference path="../v8.d.ts" />
|
||||
/// <reference path="../vm.d.ts" />
|
||||
/// <reference path="../worker_threads.d.ts" />
|
||||
/// <reference path="../zlib.d.ts" />
|
||||
|
||||
8
types/node/ts3.4/index.d.ts
vendored
8
types/node/ts3.4/index.d.ts
vendored
@ -4,9 +4,5 @@
|
||||
// Typically type modifiations should be made in base.d.ts instead of here
|
||||
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/assert.d.ts" />
|
||||
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/globals.global.d.ts" />
|
||||
/// <reference path="assert.d.ts" />
|
||||
/// <reference path="globals.global.d.ts" />
|
||||
|
||||
@ -1,31 +1,356 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
import '../ts3.1/node-tests';
|
||||
import '../ts3.1/assert';
|
||||
import '../ts3.1/buffer';
|
||||
import '../ts3.1/child_process';
|
||||
import '../ts3.1/cluster';
|
||||
import '../ts3.1/crypto';
|
||||
import '../ts3.1/dgram';
|
||||
import '../ts3.1/global';
|
||||
import '../ts3.1/http';
|
||||
import '../ts3.1/http2';
|
||||
import '../ts3.1/net';
|
||||
import '../ts3.1/os';
|
||||
import '../ts3.1/path';
|
||||
import '../ts3.1/perf_hooks';
|
||||
import '../ts3.1/process';
|
||||
import '../ts3.1/querystring';
|
||||
import '../ts3.1/readline';
|
||||
import '../ts3.1/repl';
|
||||
import '../ts3.1/stream';
|
||||
import '../ts3.1/tls';
|
||||
import '../ts3.1/tty';
|
||||
import '../ts3.1/util';
|
||||
import '../ts3.1/worker_threads';
|
||||
import '../ts3.1/zlib';
|
||||
import * as fs from "fs";
|
||||
import * as url from "url";
|
||||
import * as util from "util";
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
import * as net from "net";
|
||||
import * as console2 from "console";
|
||||
import * as timers from "timers";
|
||||
import * as inspector from "inspector";
|
||||
import * as trace_events from "trace_events";
|
||||
|
||||
import { types, promisify } from 'util';
|
||||
import { BigIntStats, statSync, Stats } from 'fs';
|
||||
//////////////////////////////////////////////////////
|
||||
/// Https tests : http://nodejs.org/api/https.html ///
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
let agent: https.Agent = new https.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 10000,
|
||||
maxSockets: Infinity,
|
||||
maxFreeSockets: 256,
|
||||
maxCachedSessions: 100,
|
||||
timeout: 15000
|
||||
});
|
||||
|
||||
agent = https.globalAgent;
|
||||
|
||||
let sockets: NodeJS.ReadOnlyDict<net.Socket[]> = agent.sockets;
|
||||
sockets = agent.freeSockets;
|
||||
|
||||
https.request({
|
||||
agent: false
|
||||
});
|
||||
https.request({
|
||||
agent
|
||||
});
|
||||
https.request({
|
||||
agent: undefined
|
||||
});
|
||||
|
||||
https.get('http://www.example.com/xyz');
|
||||
https.request('http://www.example.com/xyz');
|
||||
|
||||
https.get('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
https.request('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'));
|
||||
https.request(new url.URL('http://www.example.com/xyz'));
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
|
||||
const opts: https.RequestOptions = {
|
||||
path: '/some/path'
|
||||
};
|
||||
https.get(new url.URL('http://www.example.com'), opts);
|
||||
https.request(new url.URL('http://www.example.com'), opts);
|
||||
https.get(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.globalAgent.options.ca = [];
|
||||
|
||||
{
|
||||
function reqListener(req: http.IncomingMessage, res: http.ServerResponse): void {}
|
||||
|
||||
class MyIncomingMessage extends http.IncomingMessage {
|
||||
foo: number;
|
||||
}
|
||||
|
||||
class MyServerResponse extends http.ServerResponse {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
let server: https.Server;
|
||||
|
||||
server = new https.Server();
|
||||
server = new https.Server(reqListener);
|
||||
server = new https.Server({ IncomingMessage: MyIncomingMessage});
|
||||
|
||||
server = new https.Server({
|
||||
IncomingMessage: MyIncomingMessage,
|
||||
ServerResponse: MyServerResponse
|
||||
}, reqListener);
|
||||
|
||||
server = https.createServer();
|
||||
server = https.createServer(reqListener);
|
||||
server = https.createServer({ IncomingMessage: MyIncomingMessage });
|
||||
server = https.createServer({ ServerResponse: MyServerResponse }, reqListener);
|
||||
|
||||
const timeout: number = server.timeout;
|
||||
const listening: boolean = server.listening;
|
||||
const keepAliveTimeout: number = server.keepAliveTimeout;
|
||||
const maxHeadersCount: number | null = server.maxHeadersCount;
|
||||
const headersTimeout: number = server.headersTimeout;
|
||||
server.setTimeout().setTimeout(1000).setTimeout(() => {}).setTimeout(100, () => {});
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/// Timers tests : https://nodejs.org/api/timers.html
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const immediate = timers
|
||||
.setImmediate(() => {
|
||||
console.log('immediate');
|
||||
})
|
||||
.unref()
|
||||
.ref();
|
||||
const b: boolean = immediate.hasRef();
|
||||
timers.clearImmediate(immediate);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setInterval(() => {
|
||||
console.log('interval');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearInterval(timeout);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setTimeout(() => {
|
||||
console.log('timeout');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearTimeout(timeout);
|
||||
}
|
||||
async function testPromisify(doSomething: {
|
||||
(foo: any, onSuccessCallback: (result: string) => void, onErrorCallback: (reason: any) => void): void;
|
||||
[util.promisify.custom](foo: any): Promise<string>;
|
||||
}) {
|
||||
const setTimeout = util.promisify(timers.setTimeout);
|
||||
let v: void = await setTimeout(100); // tslint:disable-line no-void-expression void-return
|
||||
let s: string = await setTimeout(100, "");
|
||||
|
||||
const setImmediate = util.promisify(timers.setImmediate);
|
||||
v = await setImmediate(); // tslint:disable-line no-void-expression
|
||||
s = await setImmediate("");
|
||||
|
||||
// $ExpectType (foo: any) => Promise<string>
|
||||
const doSomethingPromise = util.promisify(doSomething);
|
||||
|
||||
// $ExpectType string
|
||||
s = await doSomethingPromise('foo');
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
/// Errors Tests : https://nodejs.org/api/errors.html ///
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
Error.stackTraceLimit = Infinity;
|
||||
}
|
||||
{
|
||||
const myObject = {};
|
||||
Error.captureStackTrace(myObject);
|
||||
}
|
||||
{
|
||||
const frames: NodeJS.CallSite[] = [];
|
||||
Error.prepareStackTrace!(new Error(), frames);
|
||||
}
|
||||
{
|
||||
const frame: NodeJS.CallSite = null!;
|
||||
const frameThis: any = frame.getThis();
|
||||
const typeName: string | null = frame.getTypeName();
|
||||
const func: Function | undefined = frame.getFunction();
|
||||
const funcName: string | null = frame.getFunctionName();
|
||||
const meth: string | null = frame.getMethodName();
|
||||
const fname: string | null = frame.getFileName();
|
||||
const lineno: number | null = frame.getLineNumber();
|
||||
const colno: number | null = frame.getColumnNumber();
|
||||
const evalOrigin: string | undefined = frame.getEvalOrigin();
|
||||
const isTop: boolean = frame.isToplevel();
|
||||
const isEval: boolean = frame.isEval();
|
||||
const isNative: boolean = frame.isNative();
|
||||
const isConstr: boolean = frame.isConstructor();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Console Tests : https://nodejs.org/api/console.html ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
let _c: Console = console;
|
||||
_c = console2;
|
||||
}
|
||||
{
|
||||
const writeStream = fs.createWriteStream('./index.d.ts');
|
||||
let consoleInstance: Console = new console.Console(writeStream);
|
||||
|
||||
consoleInstance = new console.Console(writeStream, writeStream);
|
||||
consoleInstance = new console.Console(writeStream, writeStream, true);
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
stderr: writeStream,
|
||||
colorMode: 'auto',
|
||||
ignoreErrors: true
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
colorMode: false
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream
|
||||
});
|
||||
}
|
||||
{
|
||||
console.assert('value');
|
||||
console.assert('value', 'message');
|
||||
console.assert('value', 'message', 'foo', 'bar');
|
||||
console.clear();
|
||||
console.count();
|
||||
console.count('label');
|
||||
console.countReset();
|
||||
console.countReset('label');
|
||||
console.debug();
|
||||
console.debug('message');
|
||||
console.debug('message', 'foo', 'bar');
|
||||
console.dir('obj');
|
||||
console.dir('obj', { depth: 1 });
|
||||
console.error();
|
||||
console.error('message');
|
||||
console.error('message', 'foo', 'bar');
|
||||
console.group();
|
||||
console.group('label');
|
||||
console.group('label1', 'label2');
|
||||
console.groupCollapsed();
|
||||
console.groupEnd();
|
||||
console.info();
|
||||
console.info('message');
|
||||
console.info('message', 'foo', 'bar');
|
||||
console.log();
|
||||
console.log('message');
|
||||
console.log('message', 'foo', 'bar');
|
||||
console.table({ foo: 'bar' });
|
||||
console.table([{ foo: 'bar' }]);
|
||||
console.table([{ foo: 'bar' }], ['foo']);
|
||||
console.time();
|
||||
console.time('label');
|
||||
console.timeEnd();
|
||||
console.timeEnd('label');
|
||||
console.timeLog();
|
||||
console.timeLog('label');
|
||||
console.timeLog('label', 'foo', 'bar');
|
||||
console.trace();
|
||||
console.trace('message');
|
||||
console.trace('message', 'foo', 'bar');
|
||||
console.warn();
|
||||
console.warn('message');
|
||||
console.warn('message', 'foo', 'bar');
|
||||
|
||||
// --- Inspector mode only ---
|
||||
console.profile();
|
||||
console.profile('label');
|
||||
console.profileEnd();
|
||||
console.profileEnd('label');
|
||||
console.timeStamp();
|
||||
console.timeStamp('label');
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* The following tests are the modules not mentioned in document but existed *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Inspector Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const b: inspector.Console.ConsoleMessage = {source: 'test', text: 'test', level: 'error' };
|
||||
inspector.open();
|
||||
inspector.open(0);
|
||||
inspector.open(0, 'localhost');
|
||||
inspector.open(0, 'localhost', true);
|
||||
inspector.close();
|
||||
const inspectorUrl: string | undefined = inspector.url();
|
||||
|
||||
const session = new inspector.Session();
|
||||
session.connect();
|
||||
session.disconnect();
|
||||
|
||||
// Unknown post method
|
||||
session.post('A.b', { key: 'value' }, (err, params) => {});
|
||||
// TODO: parameters are implicitly 'any' and need type annotation
|
||||
session.post('A.b', (err: Error | null, params?: {}) => {});
|
||||
session.post('A.b');
|
||||
// Known post method
|
||||
const parameter: inspector.Runtime.EvaluateParameterType = { expression: '2 + 2' };
|
||||
session.post('Runtime.evaluate', parameter,
|
||||
(err: Error | null, params: inspector.Runtime.EvaluateReturnType) => {});
|
||||
session.post('Runtime.evaluate', (err: Error, params: inspector.Runtime.EvaluateReturnType) => {
|
||||
const exceptionDetails: inspector.Runtime.ExceptionDetails = params.exceptionDetails!;
|
||||
const resultClassName: string = params.result.className!;
|
||||
});
|
||||
session.post('Runtime.evaluate');
|
||||
|
||||
// General event
|
||||
session.on('inspectorNotification', message => {
|
||||
message; // $ExpectType InspectorNotification<{}>
|
||||
});
|
||||
// Known events
|
||||
session.on('Debugger.paused', (message: inspector.InspectorNotification<inspector.Debugger.PausedEventDataType>) => {
|
||||
const method: string = message.method;
|
||||
const pauseReason: string = message.params.reason;
|
||||
});
|
||||
session.on('Debugger.resumed', () => {});
|
||||
// Node Inspector events
|
||||
session.on('NodeTracing.dataCollected', (message: inspector.InspectorNotification<inspector.NodeTracing.DataCollectedEventDataType>) => {
|
||||
const value: Array<{}> = message.params.value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Trace Events Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const enabledCategories: string | undefined = trace_events.getEnabledCategories();
|
||||
const tracing: trace_events.Tracing = trace_events.createTracing({ categories: ['node', 'v8'] });
|
||||
const categories: string = tracing.categories;
|
||||
const enabled: boolean = tracing.enabled;
|
||||
tracing.enable();
|
||||
tracing.disable();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Node.js ESNEXT Support
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const s = 'foo';
|
||||
const s1: string = s.trimLeft();
|
||||
const s2: string = s.trimRight();
|
||||
const s3: string = s.trimStart();
|
||||
const s4: string = s.trimEnd();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
/// Global Tests : https://nodejs.org/api/global.html ///
|
||||
@ -39,10 +364,10 @@ import { BigIntStats, statSync, Stats } from 'fs';
|
||||
// Util Tests
|
||||
{
|
||||
const value: BigInt64Array | BigUint64Array | number = [] as any;
|
||||
if (types.isBigInt64Array(value)) {
|
||||
if (util.types.isBigInt64Array(value)) {
|
||||
// $ExpectType BigInt64Array
|
||||
const b = value;
|
||||
} else if (types.isBigUint64Array(value)) {
|
||||
} else if (util.types.isBigUint64Array(value)) {
|
||||
// $ExpectType BigUint64Array
|
||||
const b = value;
|
||||
} else {
|
||||
@ -50,15 +375,15 @@ import { BigIntStats, statSync, Stats } from 'fs';
|
||||
const b = value;
|
||||
}
|
||||
|
||||
const arg1UnknownError: (arg: string) => Promise<number> = promisify((arg: string, cb: (err: unknown, result: number) => void): void => { });
|
||||
const arg1AnyError: (arg: string) => Promise<number> = promisify((arg: string, cb: (err: any, result: number) => void): void => { });
|
||||
const arg1UnknownError: (arg: string) => Promise<number> = util.promisify((arg: string, cb: (err: unknown, result: number) => void): void => { });
|
||||
const arg1AnyError: (arg: string) => Promise<number> = util.promisify((arg: string, cb: (err: any, result: number) => void): void => { });
|
||||
}
|
||||
|
||||
// FS Tests
|
||||
{
|
||||
const bigStats: BigIntStats = statSync('.', { bigint: true });
|
||||
const bigStats: fs.BigIntStats = fs.statSync('.', { bigint: true });
|
||||
const bigIntStat: bigint = bigStats.atimeNs;
|
||||
const anyStats: Stats | BigIntStats = statSync('.', { bigint: Math.random() > 0.5 });
|
||||
const anyStats: fs.Stats | fs.BigIntStats = fs.statSync('.', { bigint: Math.random() > 0.5 });
|
||||
}
|
||||
|
||||
// Global Tests
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-bad-reference": false
|
||||
}
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"no-bad-reference": false,
|
||||
"no-empty-interface": false,
|
||||
"no-single-declare-module": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
|
||||
2
types/node/ts3.6/index.d.ts
vendored
2
types/node/ts3.6/index.d.ts
vendored
@ -5,4 +5,4 @@
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/assert.d.ts" />
|
||||
/// <reference path="../ts3.4/assert.d.ts" />
|
||||
|
||||
@ -1,29 +1,5 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
import '../ts3.1/node-tests';
|
||||
import '../ts3.1/assert';
|
||||
import '../ts3.1/buffer';
|
||||
import '../ts3.1/child_process';
|
||||
import '../ts3.1/cluster';
|
||||
import '../ts3.1/crypto';
|
||||
import '../ts3.1/dgram';
|
||||
import '../ts3.1/ts3.2/fs';
|
||||
import '../ts3.1/ts3.2/global';
|
||||
import '../ts3.1/http';
|
||||
import '../ts3.1/http2';
|
||||
import '../ts3.1/net';
|
||||
import '../ts3.1/os';
|
||||
import '../ts3.1/path';
|
||||
import '../ts3.1/perf_hooks';
|
||||
import '../ts3.1/process';
|
||||
import '../ts3.1/querystring';
|
||||
import '../ts3.1/readline';
|
||||
import '../ts3.1/repl';
|
||||
import '../ts3.1/stream';
|
||||
import '../ts3.1/tls';
|
||||
import '../ts3.1/tty';
|
||||
import '../ts3.1/ts3.2/util';
|
||||
import '../ts3.1/worker_threads';
|
||||
import '../ts3.1/zlib';
|
||||
import '../ts3.4/node-tests';
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/// WASI tests : https://nodejs.org/api/wasi.html ///
|
||||
|
||||
193
types/node/util.d.ts
vendored
193
types/node/util.d.ts
vendored
@ -1,9 +1,196 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="ts3.1/util.d.ts" />
|
||||
|
||||
declare module "util" {
|
||||
interface InspectOptions extends NodeJS.InspectOptions { }
|
||||
type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module';
|
||||
type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string;
|
||||
interface InspectOptionsStylized extends InspectOptions {
|
||||
stylize(text: string, styleType: Style): string;
|
||||
}
|
||||
function format(format: any, ...param: any[]): string;
|
||||
function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
|
||||
/** @deprecated since v0.11.3 - use a third party module instead. */
|
||||
function log(string: string): void;
|
||||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
function inspect(object: any, options: InspectOptions): string;
|
||||
namespace inspect {
|
||||
let colors: NodeJS.Dict<[number, number]>;
|
||||
let styles: {
|
||||
[K in Style]: string
|
||||
};
|
||||
let defaultOptions: InspectOptions;
|
||||
/**
|
||||
* Allows changing inspect settings from the repl.
|
||||
*/
|
||||
let replDefaults: InspectOptions;
|
||||
const custom: unique symbol;
|
||||
}
|
||||
/** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
|
||||
function isArray(object: any): object is any[];
|
||||
/** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
|
||||
function isDate(object: any): object is Date;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
|
||||
function isError(object: any): object is Error;
|
||||
function inherits(constructor: any, superConstructor: any): void;
|
||||
function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
|
||||
function isBoolean(object: any): object is boolean;
|
||||
/** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
|
||||
function isBuffer(object: any): object is Buffer;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
|
||||
function isFunction(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `value === null` instead. */
|
||||
function isNull(object: any): object is null;
|
||||
/** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
|
||||
function isNullOrUndefined(object: any): object is null | undefined;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
|
||||
function isNumber(object: any): object is number;
|
||||
/** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
|
||||
function isObject(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
|
||||
function isPrimitive(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
|
||||
function isString(object: any): object is string;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
|
||||
function isSymbol(object: any): object is symbol;
|
||||
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
|
||||
function isUndefined(object: any): object is undefined;
|
||||
function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
|
||||
function isDeepStrictEqual(val1: any, val2: any): boolean;
|
||||
|
||||
function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
|
||||
interface CustomPromisifyLegacy<TCustom extends Function> extends Function {
|
||||
__promisify__: TCustom;
|
||||
}
|
||||
|
||||
interface CustomPromisifySymbol<TCustom extends Function> extends Function {
|
||||
[promisify.custom]: TCustom;
|
||||
}
|
||||
|
||||
type CustomPromisify<TCustom extends Function> = CustomPromisifySymbol<TCustom> | CustomPromisifyLegacy<TCustom>;
|
||||
|
||||
function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
||||
function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
|
||||
function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
||||
function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
||||
function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
||||
function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
||||
function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
||||
function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
function promisify(fn: Function): Function;
|
||||
namespace promisify {
|
||||
const custom: unique symbol;
|
||||
}
|
||||
|
||||
namespace types {
|
||||
function isAnyArrayBuffer(object: any): boolean;
|
||||
function isArgumentsObject(object: any): object is IArguments;
|
||||
function isArrayBuffer(object: any): object is ArrayBuffer;
|
||||
function isArrayBufferView(object: any): object is ArrayBufferView;
|
||||
function isAsyncFunction(object: any): boolean;
|
||||
function isBigInt64Array(value: any): value is BigInt64Array;
|
||||
function isBigUint64Array(value: any): value is BigUint64Array;
|
||||
function isBooleanObject(object: any): object is Boolean;
|
||||
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
|
||||
function isDataView(object: any): object is DataView;
|
||||
function isDate(object: any): object is Date;
|
||||
function isExternal(object: any): boolean;
|
||||
function isFloat32Array(object: any): object is Float32Array;
|
||||
function isFloat64Array(object: any): object is Float64Array;
|
||||
function isGeneratorFunction(object: any): boolean;
|
||||
function isGeneratorObject(object: any): boolean;
|
||||
function isInt8Array(object: any): object is Int8Array;
|
||||
function isInt16Array(object: any): object is Int16Array;
|
||||
function isInt32Array(object: any): object is Int32Array;
|
||||
function isMap(object: any): boolean;
|
||||
function isMapIterator(object: any): boolean;
|
||||
function isModuleNamespaceObject(value: any): boolean;
|
||||
function isNativeError(object: any): object is Error;
|
||||
function isNumberObject(object: any): object is Number;
|
||||
function isPromise(object: any): boolean;
|
||||
function isProxy(object: any): boolean;
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
function isSet(object: any): boolean;
|
||||
function isSetIterator(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): boolean;
|
||||
function isStringObject(object: any): boolean;
|
||||
function isSymbolObject(object: any): boolean;
|
||||
function isTypedArray(object: any): object is NodeJS.TypedArray;
|
||||
function isUint8Array(object: any): object is Uint8Array;
|
||||
function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
||||
function isUint16Array(object: any): object is Uint16Array;
|
||||
function isUint32Array(object: any): object is Uint32Array;
|
||||
function isWeakMap(object: any): boolean;
|
||||
function isWeakSet(object: any): boolean;
|
||||
function isWebAssemblyCompiledModule(object: any): boolean;
|
||||
}
|
||||
|
||||
class TextDecoder {
|
||||
readonly encoding: string;
|
||||
readonly fatal: boolean;
|
||||
readonly ignoreBOM: boolean;
|
||||
constructor(
|
||||
encoding?: string,
|
||||
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
||||
);
|
||||
decode(
|
||||
input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
||||
options?: { stream?: boolean }
|
||||
): string;
|
||||
}
|
||||
|
||||
interface EncodeIntoResult {
|
||||
/**
|
||||
* The read Unicode code units of input.
|
||||
*/
|
||||
|
||||
read: number;
|
||||
/**
|
||||
* The written UTF-8 bytes of output.
|
||||
*/
|
||||
written: number;
|
||||
}
|
||||
|
||||
class TextEncoder {
|
||||
readonly encoding: string;
|
||||
encode(input?: string): Uint8Array;
|
||||
encodeInto(input: string, output: Uint8Array): EncodeIntoResult;
|
||||
}
|
||||
}
|
||||
|
||||
1010
types/node/v10/globals.d.ts
vendored
1010
types/node/v10/globals.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -2,11 +2,6 @@
|
||||
"private": true,
|
||||
"types": "index",
|
||||
"typesVersions": {
|
||||
"<=3.1": {
|
||||
"*": [
|
||||
"ts3.1/*"
|
||||
]
|
||||
},
|
||||
"<=3.6": {
|
||||
"*": [
|
||||
"ts3.6/*"
|
||||
|
||||
40
types/node/v10/ts3.1/base.d.ts
vendored
40
types/node/v10/ts3.1/base.d.ts
vendored
@ -1,40 +0,0 @@
|
||||
// base definitions for all NodeJS modules that are not specific to any version of TypeScript
|
||||
/// <reference path="globals.d.ts" />
|
||||
/// <reference path="../async_hooks.d.ts" />
|
||||
/// <reference path="../buffer.d.ts" />
|
||||
/// <reference path="../child_process.d.ts" />
|
||||
/// <reference path="../cluster.d.ts" />
|
||||
/// <reference path="../console.d.ts" />
|
||||
/// <reference path="../constants.d.ts" />
|
||||
/// <reference path="../crypto.d.ts" />
|
||||
/// <reference path="../dgram.d.ts" />
|
||||
/// <reference path="../dns.d.ts" />
|
||||
/// <reference path="../domain.d.ts" />
|
||||
/// <reference path="../events.d.ts" />
|
||||
/// <reference path="../fs.d.ts" />
|
||||
/// <reference path="../http.d.ts" />
|
||||
/// <reference path="../http2.d.ts" />
|
||||
/// <reference path="../https.d.ts" />
|
||||
/// <reference path="../inspector.d.ts" />
|
||||
/// <reference path="../module.d.ts" />
|
||||
/// <reference path="../net.d.ts" />
|
||||
/// <reference path="../os.d.ts" />
|
||||
/// <reference path="../path.d.ts" />
|
||||
/// <reference path="../perf_hooks.d.ts" />
|
||||
/// <reference path="../process.d.ts" />
|
||||
/// <reference path="../punycode.d.ts" />
|
||||
/// <reference path="../querystring.d.ts" />
|
||||
/// <reference path="../readline.d.ts" />
|
||||
/// <reference path="../repl.d.ts" />
|
||||
/// <reference path="../stream.d.ts" />
|
||||
/// <reference path="../string_decoder.d.ts" />
|
||||
/// <reference path="../timers.d.ts" />
|
||||
/// <reference path="../tls.d.ts" />
|
||||
/// <reference path="../trace_events.d.ts" />
|
||||
/// <reference path="../tty.d.ts" />
|
||||
/// <reference path="../url.d.ts" />
|
||||
/// <reference path="util.d.ts" />
|
||||
/// <reference path="../v8.d.ts" />
|
||||
/// <reference path="../vm.d.ts" />
|
||||
/// <reference path="../worker_threads.d.ts" />
|
||||
/// <reference path="../zlib.d.ts" />
|
||||
1013
types/node/v10/ts3.1/globals.d.ts
vendored
1013
types/node/v10/ts3.1/globals.d.ts
vendored
File diff suppressed because it is too large
Load Diff
55
types/node/v10/ts3.1/index.d.ts
vendored
55
types/node/v10/ts3.1/index.d.ts
vendored
@ -1,55 +0,0 @@
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.1.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
|
||||
// - ~/ts3.1/index.d.ts - Definitions specific to TypeScript 3.1
|
||||
|
||||
// NOTE: Augmentations for TypeScript 3.1 and later should use individual files for overrides
|
||||
// within the respective ~/ts3.1 (or later) folder. However, this is disallowed for versions
|
||||
// prior to TypeScript 3.1, so the older definitions will be found here.
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// We can't include assert.d.ts in base.d.ts, as it'll cause duplication errors in +ts3.7
|
||||
/// <reference path="assert.d.ts" />
|
||||
|
||||
// TypeScript 2.1-specific augmentations:
|
||||
|
||||
// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
|
||||
interface MapConstructor { }
|
||||
interface WeakMapConstructor { }
|
||||
interface SetConstructor { }
|
||||
interface WeakSetConstructor { }
|
||||
interface Set<T> {}
|
||||
interface ReadonlySet<T> {}
|
||||
interface IteratorResult<T> { }
|
||||
interface Iterable<T> { }
|
||||
interface Iterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
}
|
||||
interface IterableIterator<T> { }
|
||||
interface AsyncIterableIterator<T> {}
|
||||
interface SymbolConstructor {
|
||||
readonly iterator: symbol;
|
||||
readonly asyncIterator: symbol;
|
||||
}
|
||||
declare var Symbol: SymbolConstructor;
|
||||
interface SharedArrayBuffer {
|
||||
readonly byteLength: number;
|
||||
slice(begin?: number, end?: number): SharedArrayBuffer;
|
||||
}
|
||||
|
||||
declare module "util" {
|
||||
namespace inspect {
|
||||
const custom: symbol;
|
||||
}
|
||||
namespace promisify {
|
||||
const custom: symbol;
|
||||
}
|
||||
namespace types {
|
||||
function isBigInt64Array(value: any): boolean;
|
||||
function isBigUint64Array(value: any): boolean;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,30 +0,0 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../../",
|
||||
"typeRoots": [
|
||||
"../../../"
|
||||
],
|
||||
"paths": {
|
||||
"node": [
|
||||
"node/v10"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"no-bad-reference": false,
|
||||
"no-empty-interface": false,
|
||||
"no-single-declare-module": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
171
types/node/v10/ts3.1/util.d.ts
vendored
171
types/node/v10/ts3.1/util.d.ts
vendored
@ -1,171 +0,0 @@
|
||||
declare module "util" {
|
||||
interface InspectOptions extends NodeJS.InspectOptions { }
|
||||
function format(format: any, ...param: any[]): string;
|
||||
function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
|
||||
/** @deprecated since v0.11.3 - use `console.error()` instead. */
|
||||
function debug(string: string): void;
|
||||
/** @deprecated since v0.11.3 - use `console.error()` instead. */
|
||||
function error(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use `console.log()` instead. */
|
||||
function puts(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use `console.log()` instead. */
|
||||
function print(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use a third party module instead. */
|
||||
function log(string: string): void;
|
||||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
function inspect(object: any, options: InspectOptions): string;
|
||||
namespace inspect {
|
||||
let colors: {
|
||||
[color: string]: [number, number] | undefined
|
||||
};
|
||||
let styles: {
|
||||
[style: string]: string | undefined
|
||||
};
|
||||
let defaultOptions: InspectOptions;
|
||||
}
|
||||
/** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
|
||||
function isArray(object: any): object is any[];
|
||||
/** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
|
||||
function isDate(object: any): object is Date;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
|
||||
function isError(object: any): object is Error;
|
||||
function inherits(constructor: any, superConstructor: any): void;
|
||||
function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
|
||||
function isBoolean(object: any): object is boolean;
|
||||
/** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
|
||||
function isBuffer(object: any): object is Buffer;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
|
||||
function isFunction(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `value === null` instead. */
|
||||
function isNull(object: any): object is null;
|
||||
/** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
|
||||
function isNullOrUndefined(object: any): object is null | undefined;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
|
||||
function isNumber(object: any): object is number;
|
||||
/** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
|
||||
function isObject(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
|
||||
function isPrimitive(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
|
||||
function isString(object: any): object is string;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
|
||||
function isSymbol(object: any): object is symbol;
|
||||
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
|
||||
function isUndefined(object: any): object is undefined;
|
||||
function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
|
||||
function isDeepStrictEqual(val1: any, val2: any): boolean;
|
||||
|
||||
interface CustomPromisify<TCustom extends Function> extends Function {
|
||||
__promisify__: TCustom;
|
||||
}
|
||||
|
||||
function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
|
||||
function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
||||
function promisify<TResult>(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise<TResult>;
|
||||
function promisify(fn: (callback: (err?: Error | null) => void) => void): () => Promise<void>;
|
||||
function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
||||
function promisify<T1>(fn: (arg1: T1, callback: (err?: Error | null) => void) => void): (arg1: T1) => Promise<void>;
|
||||
function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
||||
function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
||||
function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error | null) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
function promisify(fn: Function): Function;
|
||||
|
||||
namespace types {
|
||||
function isAnyArrayBuffer(object: any): boolean;
|
||||
function isArgumentsObject(object: any): object is IArguments;
|
||||
function isArrayBuffer(object: any): object is ArrayBuffer;
|
||||
function isArrayBufferView(object: any): object is ArrayBufferView;
|
||||
function isAsyncFunction(object: any): boolean;
|
||||
function isBooleanObject(object: any): object is Boolean;
|
||||
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
|
||||
function isDataView(object: any): object is DataView;
|
||||
function isDate(object: any): object is Date;
|
||||
function isExternal(object: any): boolean;
|
||||
function isFloat32Array(object: any): object is Float32Array;
|
||||
function isFloat64Array(object: any): object is Float64Array;
|
||||
function isGeneratorFunction(object: any): boolean;
|
||||
function isGeneratorObject(object: any): boolean;
|
||||
function isInt8Array(object: any): object is Int8Array;
|
||||
function isInt16Array(object: any): object is Int16Array;
|
||||
function isInt32Array(object: any): object is Int32Array;
|
||||
function isMap(object: any): boolean;
|
||||
function isMapIterator(object: any): boolean;
|
||||
function isModuleNamespaceObject(value: any): boolean;
|
||||
function isNativeError(object: any): object is Error;
|
||||
function isNumberObject(object: any): object is Number;
|
||||
function isPromise(object: any): boolean;
|
||||
function isProxy(object: any): boolean;
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
function isSet(object: any): boolean;
|
||||
function isSetIterator(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): boolean;
|
||||
function isStringObject(object: any): boolean;
|
||||
function isSymbolObject(object: any): boolean;
|
||||
function isTypedArray(object: any): object is NodeJS.TypedArray;
|
||||
function isUint8Array(object: any): object is Uint8Array;
|
||||
function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
||||
function isUint16Array(object: any): object is Uint16Array;
|
||||
function isUint32Array(object: any): object is Uint32Array;
|
||||
function isWeakMap(object: any): boolean;
|
||||
function isWeakSet(object: any): boolean;
|
||||
function isWebAssemblyCompiledModule(object: any): boolean;
|
||||
}
|
||||
|
||||
class TextDecoder {
|
||||
readonly encoding: string;
|
||||
readonly fatal: boolean;
|
||||
readonly ignoreBOM: boolean;
|
||||
constructor(
|
||||
encoding?: string,
|
||||
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
||||
);
|
||||
decode(
|
||||
input?: NodeJS.TypedArray | DataView | ArrayBuffer | null,
|
||||
options?: { stream?: boolean }
|
||||
): string;
|
||||
}
|
||||
|
||||
class TextEncoder {
|
||||
readonly encoding: string;
|
||||
constructor();
|
||||
encode(input?: string): Uint8Array;
|
||||
}
|
||||
}
|
||||
45
types/node/v10/ts3.6/base.d.ts
vendored
45
types/node/v10/ts3.6/base.d.ts
vendored
@ -12,10 +12,43 @@
|
||||
/// <reference lib="esnext.intl" />
|
||||
/// <reference lib="esnext.bigint" />
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/base.d.ts" />
|
||||
|
||||
// TypeScript 3.2-specific augmentations:
|
||||
/// <reference path="../util.d.ts" />
|
||||
// base definitions for all NodeJS modules that are not specific to any version of TypeScript
|
||||
/// <reference path="../globals.d.ts" />
|
||||
/// <reference path="../async_hooks.d.ts" />
|
||||
/// <reference path="../buffer.d.ts" />
|
||||
/// <reference path="../child_process.d.ts" />
|
||||
/// <reference path="../cluster.d.ts" />
|
||||
/// <reference path="../console.d.ts" />
|
||||
/// <reference path="../constants.d.ts" />
|
||||
/// <reference path="../crypto.d.ts" />
|
||||
/// <reference path="../dgram.d.ts" />
|
||||
/// <reference path="../dns.d.ts" />
|
||||
/// <reference path="../domain.d.ts" />
|
||||
/// <reference path="../events.d.ts" />
|
||||
/// <reference path="../fs.d.ts" />
|
||||
/// <reference path="../http.d.ts" />
|
||||
/// <reference path="../http2.d.ts" />
|
||||
/// <reference path="../https.d.ts" />
|
||||
/// <reference path="../inspector.d.ts" />
|
||||
/// <reference path="../module.d.ts" />
|
||||
/// <reference path="../net.d.ts" />
|
||||
/// <reference path="../os.d.ts" />
|
||||
/// <reference path="../path.d.ts" />
|
||||
/// <reference path="../perf_hooks.d.ts" />
|
||||
/// <reference path="../process.d.ts" />
|
||||
/// <reference path="../punycode.d.ts" />
|
||||
/// <reference path="../querystring.d.ts" />
|
||||
/// <reference path="../readline.d.ts" />
|
||||
/// <reference path="../repl.d.ts" />
|
||||
/// <reference path="../stream.d.ts" />
|
||||
/// <reference path="../string_decoder.d.ts" />
|
||||
/// <reference path="../timers.d.ts" />
|
||||
/// <reference path="../tls.d.ts" />
|
||||
/// <reference path="../trace_events.d.ts" />
|
||||
/// <reference path="../tty.d.ts" />
|
||||
/// <reference path="../url.d.ts" />
|
||||
/// <reference path="../util.d.ts" />
|
||||
/// <reference path="../v8.d.ts" />
|
||||
/// <reference path="../vm.d.ts" />
|
||||
/// <reference path="../worker_threads.d.ts" />
|
||||
/// <reference path="../zlib.d.ts" />
|
||||
|
||||
4
types/node/v10/ts3.6/index.d.ts
vendored
4
types/node/v10/ts3.6/index.d.ts
vendored
@ -3,6 +3,4 @@
|
||||
// Typically type modifications should be made in base.d.ts instead of here
|
||||
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/assert.d.ts" />
|
||||
/// <reference path="assert.d.ts" />
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-bad-reference": false
|
||||
"ban-types": false,
|
||||
"no-bad-reference": false,
|
||||
"no-empty-interface": false,
|
||||
"no-single-declare-module": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
|
||||
170
types/node/v10/util.d.ts
vendored
170
types/node/v10/util.d.ts
vendored
@ -1,15 +1,175 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="ts3.1/util.d.ts" />
|
||||
|
||||
declare module "util" {
|
||||
interface InspectOptions extends NodeJS.InspectOptions { }
|
||||
function format(format: any, ...param: any[]): string;
|
||||
function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
|
||||
/** @deprecated since v0.11.3 - use `console.error()` instead. */
|
||||
function debug(string: string): void;
|
||||
/** @deprecated since v0.11.3 - use `console.error()` instead. */
|
||||
function error(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use `console.log()` instead. */
|
||||
function puts(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use `console.log()` instead. */
|
||||
function print(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use a third party module instead. */
|
||||
function log(string: string): void;
|
||||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
function inspect(object: any, options: InspectOptions): string;
|
||||
namespace inspect {
|
||||
let colors: {
|
||||
[color: string]: [number, number] | undefined
|
||||
};
|
||||
const custom: unique symbol;
|
||||
let styles: {
|
||||
[style: string]: string | undefined
|
||||
};
|
||||
let defaultOptions: InspectOptions;
|
||||
}
|
||||
namespace promisify {
|
||||
const custom: unique symbol;
|
||||
/** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
|
||||
function isArray(object: any): object is any[];
|
||||
/** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
|
||||
function isDate(object: any): object is Date;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
|
||||
function isError(object: any): object is Error;
|
||||
function inherits(constructor: any, superConstructor: any): void;
|
||||
function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
|
||||
function isBoolean(object: any): object is boolean;
|
||||
/** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
|
||||
function isBuffer(object: any): object is Buffer;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
|
||||
function isFunction(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `value === null` instead. */
|
||||
function isNull(object: any): object is null;
|
||||
/** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
|
||||
function isNullOrUndefined(object: any): object is null | undefined;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
|
||||
function isNumber(object: any): object is number;
|
||||
/** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
|
||||
function isObject(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
|
||||
function isPrimitive(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
|
||||
function isString(object: any): object is string;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
|
||||
function isSymbol(object: any): object is symbol;
|
||||
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
|
||||
function isUndefined(object: any): object is undefined;
|
||||
function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
|
||||
function isDeepStrictEqual(val1: any, val2: any): boolean;
|
||||
|
||||
interface CustomPromisify<TCustom extends Function> extends Function {
|
||||
__promisify__: TCustom;
|
||||
}
|
||||
|
||||
function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
|
||||
function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
||||
function promisify<TResult>(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise<TResult>;
|
||||
function promisify(fn: (callback: (err?: Error | null) => void) => void): () => Promise<void>;
|
||||
function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
||||
function promisify<T1>(fn: (arg1: T1, callback: (err?: Error | null) => void) => void): (arg1: T1) => Promise<void>;
|
||||
function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
||||
function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
||||
function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error | null) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
function promisify(fn: Function): Function;
|
||||
|
||||
namespace types {
|
||||
const custom: unique symbol;
|
||||
function isAnyArrayBuffer(object: any): boolean;
|
||||
function isArgumentsObject(object: any): object is IArguments;
|
||||
function isArrayBuffer(object: any): object is ArrayBuffer;
|
||||
function isArrayBufferView(object: any): object is ArrayBufferView;
|
||||
function isAsyncFunction(object: any): boolean;
|
||||
function isBigInt64Array(value: any): value is BigInt64Array;
|
||||
function isBigUint64Array(value: any): value is BigUint64Array;
|
||||
function isBooleanObject(object: any): object is Boolean;
|
||||
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
|
||||
function isDataView(object: any): object is DataView;
|
||||
function isDate(object: any): object is Date;
|
||||
function isExternal(object: any): boolean;
|
||||
function isFloat32Array(object: any): object is Float32Array;
|
||||
function isFloat64Array(object: any): object is Float64Array;
|
||||
function isGeneratorFunction(object: any): boolean;
|
||||
function isGeneratorObject(object: any): boolean;
|
||||
function isInt8Array(object: any): object is Int8Array;
|
||||
function isInt16Array(object: any): object is Int16Array;
|
||||
function isInt32Array(object: any): object is Int32Array;
|
||||
function isMap(object: any): boolean;
|
||||
function isMapIterator(object: any): boolean;
|
||||
function isModuleNamespaceObject(value: any): boolean;
|
||||
function isNativeError(object: any): object is Error;
|
||||
function isNumberObject(object: any): object is Number;
|
||||
function isPromise(object: any): boolean;
|
||||
function isProxy(object: any): boolean;
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
function isSet(object: any): boolean;
|
||||
function isSetIterator(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): boolean;
|
||||
function isStringObject(object: any): boolean;
|
||||
function isSymbolObject(object: any): boolean;
|
||||
function isTypedArray(object: any): object is NodeJS.TypedArray;
|
||||
function isUint8Array(object: any): object is Uint8Array;
|
||||
function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
||||
function isUint16Array(object: any): object is Uint16Array;
|
||||
function isUint32Array(object: any): object is Uint32Array;
|
||||
function isWeakMap(object: any): boolean;
|
||||
function isWeakSet(object: any): boolean;
|
||||
function isWebAssemblyCompiledModule(object: any): boolean;
|
||||
}
|
||||
|
||||
class TextDecoder {
|
||||
readonly encoding: string;
|
||||
readonly fatal: boolean;
|
||||
readonly ignoreBOM: boolean;
|
||||
constructor(
|
||||
encoding?: string,
|
||||
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
||||
);
|
||||
decode(
|
||||
input?: NodeJS.TypedArray | DataView | ArrayBuffer | null,
|
||||
options?: { stream?: boolean }
|
||||
): string;
|
||||
}
|
||||
|
||||
class TextEncoder {
|
||||
readonly encoding: string;
|
||||
constructor();
|
||||
encode(input?: string): Uint8Array;
|
||||
}
|
||||
}
|
||||
|
||||
1148
types/node/v11/globals.d.ts
vendored
1148
types/node/v11/globals.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -2,11 +2,6 @@
|
||||
"private": true,
|
||||
"types": "index",
|
||||
"typesVersions": {
|
||||
"<=3.1": {
|
||||
"*": [
|
||||
"ts3.1/*"
|
||||
]
|
||||
},
|
||||
"<=3.6": {
|
||||
"*": [
|
||||
"ts3.6/*"
|
||||
|
||||
40
types/node/v11/ts3.1/base.d.ts
vendored
40
types/node/v11/ts3.1/base.d.ts
vendored
@ -1,40 +0,0 @@
|
||||
// base definitions for all NodeJS modules that are not specific to any version of TypeScript
|
||||
/// <reference path="globals.d.ts" />
|
||||
/// <reference path="../async_hooks.d.ts" />
|
||||
/// <reference path="../buffer.d.ts" />
|
||||
/// <reference path="../child_process.d.ts" />
|
||||
/// <reference path="../cluster.d.ts" />
|
||||
/// <reference path="../console.d.ts" />
|
||||
/// <reference path="../constants.d.ts" />
|
||||
/// <reference path="../crypto.d.ts" />
|
||||
/// <reference path="../dgram.d.ts" />
|
||||
/// <reference path="../dns.d.ts" />
|
||||
/// <reference path="../domain.d.ts" />
|
||||
/// <reference path="../events.d.ts" />
|
||||
/// <reference path="../fs.d.ts" />
|
||||
/// <reference path="../http.d.ts" />
|
||||
/// <reference path="../http2.d.ts" />
|
||||
/// <reference path="../https.d.ts" />
|
||||
/// <reference path="../inspector.d.ts" />
|
||||
/// <reference path="../module.d.ts" />
|
||||
/// <reference path="../net.d.ts" />
|
||||
/// <reference path="../os.d.ts" />
|
||||
/// <reference path="../path.d.ts" />
|
||||
/// <reference path="../perf_hooks.d.ts" />
|
||||
/// <reference path="../process.d.ts" />
|
||||
/// <reference path="../punycode.d.ts" />
|
||||
/// <reference path="../querystring.d.ts" />
|
||||
/// <reference path="../readline.d.ts" />
|
||||
/// <reference path="../repl.d.ts" />
|
||||
/// <reference path="../stream.d.ts" />
|
||||
/// <reference path="../string_decoder.d.ts" />
|
||||
/// <reference path="../timers.d.ts" />
|
||||
/// <reference path="../tls.d.ts" />
|
||||
/// <reference path="../trace_events.d.ts" />
|
||||
/// <reference path="../tty.d.ts" />
|
||||
/// <reference path="../url.d.ts" />
|
||||
/// <reference path="util.d.ts" />
|
||||
/// <reference path="../v8.d.ts" />
|
||||
/// <reference path="../vm.d.ts" />
|
||||
/// <reference path="../worker_threads.d.ts" />
|
||||
/// <reference path="../zlib.d.ts" />
|
||||
1151
types/node/v11/ts3.1/globals.d.ts
vendored
1151
types/node/v11/ts3.1/globals.d.ts
vendored
File diff suppressed because it is too large
Load Diff
61
types/node/v11/ts3.1/index.d.ts
vendored
61
types/node/v11/ts3.1/index.d.ts
vendored
@ -1,61 +0,0 @@
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.2.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
|
||||
// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2
|
||||
|
||||
// NOTE: Augmentations for TypeScript 3.2 and later should use individual files for overrides
|
||||
// within the respective ~/ts3.2 (or later) folder. However, this is disallowed for versions
|
||||
// prior to TypeScript 3.2, so the older definitions will be found here.
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// We can't include assert.d.ts in base.d.ts, as it'll cause duplication errors in +ts3.7
|
||||
/// <reference path="assert.d.ts" />
|
||||
|
||||
// TypeScript 2.1-specific augmentations:
|
||||
|
||||
// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
|
||||
// Empty interfaces are used here which merge fine with the real declarations in the lib XXX files
|
||||
// just to ensure the names are known and node typings can be used without importing these libs.
|
||||
// if someone really needs these types the libs need to be added via --lib or in tsconfig.json
|
||||
interface MapConstructor { }
|
||||
interface WeakMapConstructor { }
|
||||
interface SetConstructor { }
|
||||
interface WeakSetConstructor { }
|
||||
interface Set<T> {}
|
||||
interface Map<K, V> {}
|
||||
interface ReadonlySet<T> {}
|
||||
interface IteratorResult<T> { }
|
||||
interface Iterable<T> { }
|
||||
interface Iterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
}
|
||||
interface IterableIterator<T> { }
|
||||
interface AsyncIterableIterator<T> {}
|
||||
interface SymbolConstructor {
|
||||
readonly iterator: symbol;
|
||||
readonly asyncIterator: symbol;
|
||||
}
|
||||
declare var Symbol: SymbolConstructor;
|
||||
// even this is just a forward declaration some properties are added otherwise
|
||||
// it would be allowed to pass anything to e.g. Buffer.from()
|
||||
interface SharedArrayBuffer {
|
||||
readonly byteLength: number;
|
||||
slice(begin?: number, end?: number): SharedArrayBuffer;
|
||||
}
|
||||
|
||||
declare module "util" {
|
||||
namespace inspect {
|
||||
const custom: symbol;
|
||||
}
|
||||
namespace promisify {
|
||||
const custom: symbol;
|
||||
}
|
||||
namespace types {
|
||||
function isBigInt64Array(value: any): boolean;
|
||||
function isBigUint64Array(value: any): boolean;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,30 +0,0 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../../",
|
||||
"typeRoots": [
|
||||
"../../../"
|
||||
],
|
||||
"paths": {
|
||||
"node": [
|
||||
"node/v11"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"no-bad-reference": false,
|
||||
"no-empty-interface": false,
|
||||
"no-single-declare-module": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
174
types/node/v11/ts3.1/util.d.ts
vendored
174
types/node/v11/ts3.1/util.d.ts
vendored
@ -1,174 +0,0 @@
|
||||
declare module "util" {
|
||||
interface InspectOptions extends NodeJS.InspectOptions { }
|
||||
function format(format: any, ...param: any[]): string;
|
||||
function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
|
||||
/** @deprecated since v0.11.3 - use `console.error()` instead. */
|
||||
function debug(string: string): void;
|
||||
/** @deprecated since v0.11.3 - use `console.error()` instead. */
|
||||
function error(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use `console.log()` instead. */
|
||||
function puts(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use `console.log()` instead. */
|
||||
function print(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use a third party module instead. */
|
||||
function log(string: string): void;
|
||||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
function inspect(object: any, options: InspectOptions): string;
|
||||
namespace inspect {
|
||||
let colors: {
|
||||
[color: string]: [number, number] | undefined
|
||||
};
|
||||
let styles: {
|
||||
[style: string]: string | undefined
|
||||
};
|
||||
let defaultOptions: InspectOptions;
|
||||
/**
|
||||
* Allows changing inspect settings from the repl.
|
||||
*/
|
||||
let replDefaults: InspectOptions;
|
||||
}
|
||||
/** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
|
||||
function isArray(object: any): object is any[];
|
||||
/** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
|
||||
function isDate(object: any): object is Date;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
|
||||
function isError(object: any): object is Error;
|
||||
function inherits(constructor: any, superConstructor: any): void;
|
||||
function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
|
||||
function isBoolean(object: any): object is boolean;
|
||||
/** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
|
||||
function isBuffer(object: any): object is Buffer;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
|
||||
function isFunction(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `value === null` instead. */
|
||||
function isNull(object: any): object is null;
|
||||
/** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
|
||||
function isNullOrUndefined(object: any): object is null | undefined;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
|
||||
function isNumber(object: any): object is number;
|
||||
/** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
|
||||
function isObject(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
|
||||
function isPrimitive(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
|
||||
function isString(object: any): object is string;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
|
||||
function isSymbol(object: any): object is symbol;
|
||||
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
|
||||
function isUndefined(object: any): object is undefined;
|
||||
function deprecate<T extends Function>(fn: T, message: string): T;
|
||||
function isDeepStrictEqual(val1: any, val2: any): boolean;
|
||||
|
||||
interface CustomPromisify<TCustom extends Function> extends Function {
|
||||
__promisify__: TCustom;
|
||||
}
|
||||
|
||||
function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
|
||||
function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
||||
function promisify<TResult>(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise<TResult>;
|
||||
function promisify(fn: (callback: (err?: Error) => void) => void): () => Promise<void>;
|
||||
function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
||||
function promisify<T1>(fn: (arg1: T1, callback: (err?: Error) => void) => void): (arg1: T1) => Promise<void>;
|
||||
function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
||||
function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
||||
function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
function promisify(fn: Function): Function;
|
||||
|
||||
namespace types {
|
||||
function isAnyArrayBuffer(object: any): boolean;
|
||||
function isArgumentsObject(object: any): object is IArguments;
|
||||
function isArrayBuffer(object: any): object is ArrayBuffer;
|
||||
function isArrayBufferView(object: any): object is ArrayBufferView;
|
||||
function isAsyncFunction(object: any): boolean;
|
||||
function isBooleanObject(object: any): object is Boolean;
|
||||
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
|
||||
function isDataView(object: any): object is DataView;
|
||||
function isDate(object: any): object is Date;
|
||||
function isExternal(object: any): boolean;
|
||||
function isFloat32Array(object: any): object is Float32Array;
|
||||
function isFloat64Array(object: any): object is Float64Array;
|
||||
function isGeneratorFunction(object: any): boolean;
|
||||
function isGeneratorObject(object: any): boolean;
|
||||
function isInt8Array(object: any): object is Int8Array;
|
||||
function isInt16Array(object: any): object is Int16Array;
|
||||
function isInt32Array(object: any): object is Int32Array;
|
||||
function isMap(object: any): boolean;
|
||||
function isMapIterator(object: any): boolean;
|
||||
function isModuleNamespaceObject(value: any): boolean;
|
||||
function isNativeError(object: any): object is Error;
|
||||
function isNumberObject(object: any): object is Number;
|
||||
function isPromise(object: any): boolean;
|
||||
function isProxy(object: any): boolean;
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
function isSet(object: any): boolean;
|
||||
function isSetIterator(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): boolean;
|
||||
function isStringObject(object: any): boolean;
|
||||
function isSymbolObject(object: any): boolean;
|
||||
function isTypedArray(object: any): object is NodeJS.TypedArray;
|
||||
function isUint8Array(object: any): object is Uint8Array;
|
||||
function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
||||
function isUint16Array(object: any): object is Uint16Array;
|
||||
function isUint32Array(object: any): object is Uint32Array;
|
||||
function isWeakMap(object: any): boolean;
|
||||
function isWeakSet(object: any): boolean;
|
||||
function isWebAssemblyCompiledModule(object: any): boolean;
|
||||
}
|
||||
|
||||
class TextDecoder {
|
||||
readonly encoding: string;
|
||||
readonly fatal: boolean;
|
||||
readonly ignoreBOM: boolean;
|
||||
constructor(
|
||||
encoding?: string,
|
||||
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
||||
);
|
||||
decode(
|
||||
input?: NodeJS.TypedArray | DataView | ArrayBuffer | null,
|
||||
options?: { stream?: boolean }
|
||||
): string;
|
||||
}
|
||||
|
||||
class TextEncoder {
|
||||
readonly encoding: string;
|
||||
encode(input?: string): Uint8Array;
|
||||
}
|
||||
}
|
||||
43
types/node/v11/ts3.6/base.d.ts
vendored
43
types/node/v11/ts3.6/base.d.ts
vendored
@ -13,9 +13,42 @@
|
||||
/// <reference lib="esnext.bigint" />
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/base.d.ts" />
|
||||
|
||||
// TypeScript 3.2-specific augmentations:
|
||||
/// <reference path="../util.d.ts" />
|
||||
/// <reference path="../globals.d.ts" />
|
||||
/// <reference path="../async_hooks.d.ts" />
|
||||
/// <reference path="../buffer.d.ts" />
|
||||
/// <reference path="../child_process.d.ts" />
|
||||
/// <reference path="../cluster.d.ts" />
|
||||
/// <reference path="../console.d.ts" />
|
||||
/// <reference path="../constants.d.ts" />
|
||||
/// <reference path="../crypto.d.ts" />
|
||||
/// <reference path="../dgram.d.ts" />
|
||||
/// <reference path="../dns.d.ts" />
|
||||
/// <reference path="../domain.d.ts" />
|
||||
/// <reference path="../events.d.ts" />
|
||||
/// <reference path="../fs.d.ts" />
|
||||
/// <reference path="../http.d.ts" />
|
||||
/// <reference path="../http2.d.ts" />
|
||||
/// <reference path="../https.d.ts" />
|
||||
/// <reference path="../inspector.d.ts" />
|
||||
/// <reference path="../module.d.ts" />
|
||||
/// <reference path="../net.d.ts" />
|
||||
/// <reference path="../os.d.ts" />
|
||||
/// <reference path="../path.d.ts" />
|
||||
/// <reference path="../perf_hooks.d.ts" />
|
||||
/// <reference path="../process.d.ts" />
|
||||
/// <reference path="../punycode.d.ts" />
|
||||
/// <reference path="../querystring.d.ts" />
|
||||
/// <reference path="../readline.d.ts" />
|
||||
/// <reference path="../repl.d.ts" />
|
||||
/// <reference path="../stream.d.ts" />
|
||||
/// <reference path="../string_decoder.d.ts" />
|
||||
/// <reference path="../timers.d.ts" />
|
||||
/// <reference path="../tls.d.ts" />
|
||||
/// <reference path="../trace_events.d.ts" />
|
||||
/// <reference path="../tty.d.ts" />
|
||||
/// <reference path="../url.d.ts" />
|
||||
/// <reference path="../util.d.ts" />
|
||||
/// <reference path="../v8.d.ts" />
|
||||
/// <reference path="../vm.d.ts" />
|
||||
/// <reference path="../worker_threads.d.ts" />
|
||||
/// <reference path="../zlib.d.ts" />
|
||||
|
||||
4
types/node/v11/ts3.6/index.d.ts
vendored
4
types/node/v11/ts3.6/index.d.ts
vendored
@ -3,6 +3,4 @@
|
||||
// Typically type modifiations should be made in base.d.ts instead of here
|
||||
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/assert.d.ts" />
|
||||
/// <reference path="assert.d.ts" />
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,10 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-bad-reference": false
|
||||
"ban-types": false,
|
||||
"no-bad-reference": false,
|
||||
"no-empty-interface": false,
|
||||
"no-single-declare-module": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
|
||||
172
types/node/v11/util.d.ts
vendored
172
types/node/v11/util.d.ts
vendored
@ -1,15 +1,181 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="ts3.1/util.d.ts" />
|
||||
|
||||
declare module "util" {
|
||||
interface InspectOptions extends NodeJS.InspectOptions { }
|
||||
function format(format: any, ...param: any[]): string;
|
||||
function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
|
||||
/** @deprecated since v0.11.3 - use `console.error()` instead. */
|
||||
function debug(string: string): void;
|
||||
/** @deprecated since v0.11.3 - use `console.error()` instead. */
|
||||
function error(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use `console.log()` instead. */
|
||||
function puts(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use `console.log()` instead. */
|
||||
function print(...param: any[]): void;
|
||||
/** @deprecated since v0.11.3 - use a third party module instead. */
|
||||
function log(string: string): void;
|
||||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
function inspect(object: any, options: InspectOptions): string;
|
||||
namespace inspect {
|
||||
const custom: unique symbol;
|
||||
let colors: {
|
||||
[color: string]: [number, number] | undefined
|
||||
};
|
||||
let styles: {
|
||||
[style: string]: string | undefined
|
||||
};
|
||||
let defaultOptions: InspectOptions;
|
||||
/**
|
||||
* Allows changing inspect settings from the repl.
|
||||
*/
|
||||
let replDefaults: InspectOptions;
|
||||
}
|
||||
/** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
|
||||
function isArray(object: any): object is any[];
|
||||
/** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
|
||||
function isDate(object: any): object is Date;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
|
||||
function isError(object: any): object is Error;
|
||||
function inherits(constructor: any, superConstructor: any): void;
|
||||
function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
|
||||
function isBoolean(object: any): object is boolean;
|
||||
/** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
|
||||
function isBuffer(object: any): object is Buffer;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
|
||||
function isFunction(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `value === null` instead. */
|
||||
function isNull(object: any): object is null;
|
||||
/** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
|
||||
function isNullOrUndefined(object: any): object is null | undefined;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
|
||||
function isNumber(object: any): object is number;
|
||||
/** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
|
||||
function isObject(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
|
||||
function isPrimitive(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
|
||||
function isString(object: any): object is string;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
|
||||
function isSymbol(object: any): object is symbol;
|
||||
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
|
||||
function isUndefined(object: any): object is undefined;
|
||||
function deprecate<T extends Function>(fn: T, message: string): T;
|
||||
function isDeepStrictEqual(val1: any, val2: any): boolean;
|
||||
|
||||
interface CustomPromisify<TCustom extends Function> extends Function {
|
||||
__promisify__: TCustom;
|
||||
}
|
||||
|
||||
function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
|
||||
function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
||||
function promisify<TResult>(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise<TResult>;
|
||||
function promisify(fn: (callback: (err?: Error) => void) => void): () => Promise<void>;
|
||||
function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
||||
function promisify<T1>(fn: (arg1: T1, callback: (err?: Error) => void) => void): (arg1: T1) => Promise<void>;
|
||||
function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
||||
function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
||||
function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
function promisify(fn: Function): Function;
|
||||
|
||||
namespace promisify {
|
||||
const custom: unique symbol;
|
||||
}
|
||||
|
||||
namespace types {
|
||||
function isAnyArrayBuffer(object: any): boolean;
|
||||
function isArgumentsObject(object: any): object is IArguments;
|
||||
function isArrayBuffer(object: any): object is ArrayBuffer;
|
||||
function isArrayBufferView(object: any): object is ArrayBufferView;
|
||||
function isAsyncFunction(object: any): boolean;
|
||||
function isBigInt64Array(value: any): value is BigInt64Array;
|
||||
function isBigUint64Array(value: any): value is BigUint64Array;
|
||||
function isBooleanObject(object: any): object is Boolean;
|
||||
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
|
||||
function isDataView(object: any): object is DataView;
|
||||
function isDate(object: any): object is Date;
|
||||
function isExternal(object: any): boolean;
|
||||
function isFloat32Array(object: any): object is Float32Array;
|
||||
function isFloat64Array(object: any): object is Float64Array;
|
||||
function isGeneratorFunction(object: any): boolean;
|
||||
function isGeneratorObject(object: any): boolean;
|
||||
function isInt8Array(object: any): object is Int8Array;
|
||||
function isInt16Array(object: any): object is Int16Array;
|
||||
function isInt32Array(object: any): object is Int32Array;
|
||||
function isMap(object: any): boolean;
|
||||
function isMapIterator(object: any): boolean;
|
||||
function isModuleNamespaceObject(value: any): boolean;
|
||||
function isNativeError(object: any): object is Error;
|
||||
function isNumberObject(object: any): object is Number;
|
||||
function isPromise(object: any): boolean;
|
||||
function isProxy(object: any): boolean;
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
function isSet(object: any): boolean;
|
||||
function isSetIterator(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): boolean;
|
||||
function isStringObject(object: any): boolean;
|
||||
function isSymbolObject(object: any): boolean;
|
||||
function isTypedArray(object: any): object is NodeJS.TypedArray;
|
||||
function isUint8Array(object: any): object is Uint8Array;
|
||||
function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
||||
function isUint16Array(object: any): object is Uint16Array;
|
||||
function isUint32Array(object: any): object is Uint32Array;
|
||||
function isWeakMap(object: any): boolean;
|
||||
function isWeakSet(object: any): boolean;
|
||||
function isWebAssemblyCompiledModule(object: any): boolean;
|
||||
}
|
||||
|
||||
class TextDecoder {
|
||||
readonly encoding: string;
|
||||
readonly fatal: boolean;
|
||||
readonly ignoreBOM: boolean;
|
||||
constructor(
|
||||
encoding?: string,
|
||||
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
||||
);
|
||||
decode(
|
||||
input?: NodeJS.TypedArray | DataView | ArrayBuffer | null,
|
||||
options?: { stream?: boolean }
|
||||
): string;
|
||||
}
|
||||
|
||||
class TextEncoder {
|
||||
readonly encoding: string;
|
||||
encode(input?: string): Uint8Array;
|
||||
}
|
||||
}
|
||||
|
||||
2471
types/node/v12/fs.d.ts
vendored
2471
types/node/v12/fs.d.ts
vendored
File diff suppressed because it is too large
Load Diff
1194
types/node/v12/globals.d.ts
vendored
1194
types/node/v12/globals.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -2,11 +2,6 @@
|
||||
"private": true,
|
||||
"types": "index",
|
||||
"typesVersions": {
|
||||
"<=3.1": {
|
||||
"*": [
|
||||
"ts3.1/*"
|
||||
]
|
||||
},
|
||||
"<=3.3": {
|
||||
"*": [
|
||||
"ts3.3/*"
|
||||
|
||||
40
types/node/v12/ts3.1/base.d.ts
vendored
40
types/node/v12/ts3.1/base.d.ts
vendored
@ -1,40 +0,0 @@
|
||||
// base definitions for all NodeJS modules that are not specific to any version of TypeScript
|
||||
/// <reference path="globals.d.ts" />
|
||||
/// <reference path="../async_hooks.d.ts" />
|
||||
/// <reference path="../buffer.d.ts" />
|
||||
/// <reference path="../child_process.d.ts" />
|
||||
/// <reference path="../cluster.d.ts" />
|
||||
/// <reference path="../console.d.ts" />
|
||||
/// <reference path="../constants.d.ts" />
|
||||
/// <reference path="../crypto.d.ts" />
|
||||
/// <reference path="../dgram.d.ts" />
|
||||
/// <reference path="../dns.d.ts" />
|
||||
/// <reference path="../domain.d.ts" />
|
||||
/// <reference path="../events.d.ts" />
|
||||
/// <reference path="fs.d.ts" />
|
||||
/// <reference path="../http.d.ts" />
|
||||
/// <reference path="../http2.d.ts" />
|
||||
/// <reference path="../https.d.ts" />
|
||||
/// <reference path="../inspector.d.ts" />
|
||||
/// <reference path="../module.d.ts" />
|
||||
/// <reference path="../net.d.ts" />
|
||||
/// <reference path="../os.d.ts" />
|
||||
/// <reference path="../path.d.ts" />
|
||||
/// <reference path="../perf_hooks.d.ts" />
|
||||
/// <reference path="../process.d.ts" />
|
||||
/// <reference path="../punycode.d.ts" />
|
||||
/// <reference path="../querystring.d.ts" />
|
||||
/// <reference path="../readline.d.ts" />
|
||||
/// <reference path="../repl.d.ts" />
|
||||
/// <reference path="../stream.d.ts" />
|
||||
/// <reference path="../string_decoder.d.ts" />
|
||||
/// <reference path="../timers.d.ts" />
|
||||
/// <reference path="../tls.d.ts" />
|
||||
/// <reference path="../trace_events.d.ts" />
|
||||
/// <reference path="../tty.d.ts" />
|
||||
/// <reference path="../url.d.ts" />
|
||||
/// <reference path="util.d.ts" />
|
||||
/// <reference path="../v8.d.ts" />
|
||||
/// <reference path="../vm.d.ts" />
|
||||
/// <reference path="../worker_threads.d.ts" />
|
||||
/// <reference path="../zlib.d.ts" />
|
||||
2452
types/node/v12/ts3.1/fs.d.ts
vendored
2452
types/node/v12/ts3.1/fs.d.ts
vendored
File diff suppressed because it is too large
Load Diff
1190
types/node/v12/ts3.1/globals.d.ts
vendored
1190
types/node/v12/ts3.1/globals.d.ts
vendored
File diff suppressed because it is too large
Load Diff
65
types/node/v12/ts3.1/index.d.ts
vendored
65
types/node/v12/ts3.1/index.d.ts
vendored
@ -1,65 +0,0 @@
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.2.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
|
||||
// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2
|
||||
|
||||
// NOTE: Augmentations for TypeScript 3.2 and later should use individual files for overrides
|
||||
// within the respective ~/ts3.2 (or later) folder. However, this is disallowed for versions
|
||||
// prior to TypeScript 3.2, so the older definitions will be found here.
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// We can't include globals.global.d.ts in globals.d.ts, as it'll cause duplication errors in TypeScript 3.4+
|
||||
/// <reference path="globals.global.d.ts" />
|
||||
|
||||
// We can't include assert.d.ts in base.d.ts, as it'll cause duplication errors in TypeScript 3.7+
|
||||
/// <reference path="assert.d.ts" />
|
||||
|
||||
// TypeScript 2.1-specific augmentations:
|
||||
|
||||
// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
|
||||
// Empty interfaces are used here which merge fine with the real declarations in the lib XXX files
|
||||
// just to ensure the names are known and node typings can be used without importing these libs.
|
||||
// if someone really needs these types the libs need to be added via --lib or in tsconfig.json
|
||||
interface MapConstructor { }
|
||||
interface WeakMapConstructor { }
|
||||
interface SetConstructor { }
|
||||
interface WeakSetConstructor { }
|
||||
interface Set<T> {}
|
||||
interface Map<K, V> {}
|
||||
interface ReadonlySet<T> {}
|
||||
interface Iterable<T> { }
|
||||
interface IteratorResult<T> { }
|
||||
interface AsyncIterable<T> { }
|
||||
interface Iterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
}
|
||||
interface IterableIterator<T> { }
|
||||
interface AsyncIterableIterator<T> {}
|
||||
interface SymbolConstructor {
|
||||
readonly iterator: symbol;
|
||||
readonly asyncIterator: symbol;
|
||||
}
|
||||
declare var Symbol: SymbolConstructor;
|
||||
// even this is just a forward declaration some properties are added otherwise
|
||||
// it would be allowed to pass anything to e.g. Buffer.from()
|
||||
interface SharedArrayBuffer {
|
||||
readonly byteLength: number;
|
||||
slice(begin?: number, end?: number): SharedArrayBuffer;
|
||||
}
|
||||
|
||||
declare module "util" {
|
||||
namespace inspect {
|
||||
const custom: symbol;
|
||||
}
|
||||
namespace promisify {
|
||||
const custom: symbol;
|
||||
}
|
||||
namespace types {
|
||||
function isBigInt64Array(value: any): boolean;
|
||||
function isBigUint64Array(value: any): boolean;
|
||||
}
|
||||
}
|
||||
@ -1,900 +0,0 @@
|
||||
import assert = require("assert");
|
||||
import * as fs from "fs";
|
||||
import * as url from "url";
|
||||
import * as util from "util";
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
import * as console2 from "console";
|
||||
import * as timers from "timers";
|
||||
import * as dns from "dns";
|
||||
import * as inspector from "inspector";
|
||||
import * as trace_events from "trace_events";
|
||||
import * as dgram from "dgram";
|
||||
import Module = require("module");
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Url tests : http://nodejs.org/api/url.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
url.format(url.parse('http://www.example.com/xyz'));
|
||||
|
||||
url.format('http://www.example.com/xyz');
|
||||
|
||||
// https://google.com/search?q=you're%20a%20lizard%2C%20gary
|
||||
url.format({
|
||||
protocol: 'https',
|
||||
host: "google.com",
|
||||
pathname: 'search',
|
||||
query: { q: "you're a lizard, gary" }
|
||||
});
|
||||
|
||||
const myURL = new url.URL('https://a:b@你好你好?abc#foo');
|
||||
url.format(myURL, { fragment: false, unicode: true, auth: false });
|
||||
}
|
||||
|
||||
{
|
||||
const helloUrl = url.parse('http://example.com/?hello=world', true);
|
||||
let helloQuery = helloUrl.query['hello'];
|
||||
assert.equal(helloUrl.query['hello'], 'world');
|
||||
|
||||
let strUrl = url.parse('http://example.com/?hello=world');
|
||||
let queryStr: string = strUrl.query!;
|
||||
|
||||
strUrl = url.parse('http://example.com/?hello=world', false);
|
||||
queryStr = strUrl.query!;
|
||||
|
||||
function getBoolean(): boolean { return false; }
|
||||
const urlUrl = url.parse('http://example.com/?hello=world', getBoolean());
|
||||
if (typeof(urlUrl.query) === 'string') {
|
||||
queryStr = urlUrl.query;
|
||||
} else if (urlUrl.query) {
|
||||
helloQuery = urlUrl.query['hello'];
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const ascii: string = url.domainToASCII('español.com');
|
||||
const unicode: string = url.domainToUnicode('xn--espaol-zwa.com');
|
||||
}
|
||||
|
||||
{
|
||||
let myURL = new url.URL('https://theuser:thepwd@example.org:81/foo/path?query=string#bar');
|
||||
assert.equal(myURL.hash, '#bar');
|
||||
assert.equal(myURL.host, 'example.org:81');
|
||||
assert.equal(myURL.hostname, 'example.org');
|
||||
assert.equal(myURL.href, 'https://theuser:thepwd@example.org:81/foo/path?query=string#bar');
|
||||
assert.equal(myURL.origin, 'https://example.org:81');
|
||||
assert.equal(myURL.password, 'thepwd');
|
||||
assert.equal(myURL.username, 'theuser');
|
||||
assert.equal(myURL.pathname, '/foo/path');
|
||||
assert.equal(myURL.port, "81");
|
||||
assert.equal(myURL.protocol, "https:");
|
||||
assert.equal(myURL.search, "?query=string");
|
||||
assert.equal(myURL.toString(), 'https://theuser:thepwd@example.org:81/foo/path?query=string#bar');
|
||||
assert(myURL.searchParams instanceof url.URLSearchParams);
|
||||
|
||||
myURL.host = 'example.org:82';
|
||||
myURL.hostname = 'example.com';
|
||||
myURL.href = 'http://other.com';
|
||||
myURL.hash = 'baz';
|
||||
myURL.password = "otherpwd";
|
||||
myURL.username = "otheruser";
|
||||
myURL.pathname = "/otherPath";
|
||||
myURL.port = "82";
|
||||
myURL.protocol = "http";
|
||||
myURL.search = "a=b";
|
||||
assert.equal(myURL.href, 'http://otheruser:otherpwd@other.com:82/otherPath?a=b#baz');
|
||||
|
||||
myURL = new url.URL('/foo', 'https://example.org/');
|
||||
assert.equal(myURL.href, 'https://example.org/foo');
|
||||
assert.equal(myURL.toJSON(), myURL.href);
|
||||
}
|
||||
|
||||
{
|
||||
const searchParams = new url.URLSearchParams('abc=123');
|
||||
|
||||
assert.equal(searchParams.toString(), 'abc=123');
|
||||
searchParams.forEach((value: string, name: string, me: url.URLSearchParams): void => {
|
||||
assert.equal(name, 'abc');
|
||||
assert.equal(value, '123');
|
||||
assert.equal(me, searchParams);
|
||||
});
|
||||
|
||||
assert.equal(searchParams.get('abc'), '123');
|
||||
|
||||
searchParams.append('abc', 'xyz');
|
||||
|
||||
assert.deepEqual(searchParams.getAll('abc'), ['123', 'xyz']);
|
||||
|
||||
const entries = searchParams.entries();
|
||||
assert.deepEqual(entries.next(), { value: ["abc", "123"], done: false });
|
||||
assert.deepEqual(entries.next(), { value: ["abc", "xyz"], done: false });
|
||||
assert.deepEqual(entries.next(), { value: undefined, done: true });
|
||||
|
||||
const keys = searchParams.keys();
|
||||
assert.deepEqual(keys.next(), { value: "abc", done: false });
|
||||
assert.deepEqual(keys.next(), { value: "abc", done: false });
|
||||
assert.deepEqual(keys.next(), { value: undefined, done: true });
|
||||
|
||||
const values = searchParams.values();
|
||||
assert.deepEqual(values.next(), { value: "123", done: false });
|
||||
assert.deepEqual(values.next(), { value: "xyz", done: false });
|
||||
assert.deepEqual(values.next(), { value: undefined, done: true });
|
||||
|
||||
searchParams.set('abc', 'b');
|
||||
assert.deepEqual(searchParams.getAll('abc'), ['b']);
|
||||
|
||||
searchParams.delete('a');
|
||||
assert(!searchParams.has('a'));
|
||||
assert.equal(searchParams.get('a'), null);
|
||||
|
||||
searchParams.sort();
|
||||
}
|
||||
|
||||
{
|
||||
const searchParams = new url.URLSearchParams({
|
||||
user: 'abc',
|
||||
query: ['first', 'second']
|
||||
});
|
||||
|
||||
assert.equal(searchParams.toString(), 'user=abc&query=first%2Csecond');
|
||||
assert.deepEqual(searchParams.getAll('query'), ['first,second']);
|
||||
}
|
||||
|
||||
{
|
||||
// Using an array
|
||||
const params = new url.URLSearchParams([
|
||||
['user', 'abc'],
|
||||
['query', 'first'],
|
||||
['query', 'second'],
|
||||
// ts 2.1/2.* compatibility
|
||||
// tslint:disable-next-line no-unnecessary-type-assertion
|
||||
] as Array<[string, string]>);
|
||||
assert.equal(params.toString(), 'user=abc&query=first&query=second');
|
||||
}
|
||||
|
||||
{
|
||||
let path: string = url.fileURLToPath('file://test');
|
||||
path = url.fileURLToPath(new url.URL('file://test'));
|
||||
}
|
||||
|
||||
{
|
||||
const path: url.URL = url.pathToFileURL('file://test');
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
/// Https tests : http://nodejs.org/api/https.html ///
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
let agent: https.Agent = new https.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 10000,
|
||||
maxSockets: Infinity,
|
||||
maxFreeSockets: 256,
|
||||
maxCachedSessions: 100,
|
||||
timeout: 15000
|
||||
});
|
||||
|
||||
agent = https.globalAgent;
|
||||
|
||||
https.request({
|
||||
agent: false
|
||||
});
|
||||
https.request({
|
||||
agent
|
||||
});
|
||||
https.request({
|
||||
agent: undefined
|
||||
});
|
||||
|
||||
https.get('http://www.example.com/xyz');
|
||||
https.request('http://www.example.com/xyz');
|
||||
|
||||
https.get('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
https.request('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'));
|
||||
https.request(new url.URL('http://www.example.com/xyz'));
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
|
||||
const opts: https.RequestOptions = {
|
||||
path: '/some/path'
|
||||
};
|
||||
https.get(new url.URL('http://www.example.com'), opts);
|
||||
https.request(new url.URL('http://www.example.com'), opts);
|
||||
https.get(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.globalAgent.options.ca = [];
|
||||
|
||||
{
|
||||
function reqListener(req: http.IncomingMessage, res: http.ServerResponse): void {}
|
||||
|
||||
class MyIncomingMessage extends http.IncomingMessage {
|
||||
foo: number;
|
||||
}
|
||||
|
||||
class MyServerResponse extends http.ServerResponse {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
let server: https.Server;
|
||||
|
||||
server = new https.Server();
|
||||
server = new https.Server(reqListener);
|
||||
server = new https.Server({ IncomingMessage: MyIncomingMessage});
|
||||
|
||||
server = new https.Server({
|
||||
IncomingMessage: MyIncomingMessage,
|
||||
ServerResponse: MyServerResponse
|
||||
}, reqListener);
|
||||
|
||||
server = https.createServer();
|
||||
server = https.createServer(reqListener);
|
||||
server = https.createServer({ IncomingMessage: MyIncomingMessage });
|
||||
server = https.createServer({ ServerResponse: MyServerResponse }, reqListener);
|
||||
|
||||
const timeout: number = server.timeout;
|
||||
const listening: boolean = server.listening;
|
||||
const keepAliveTimeout: number = server.keepAliveTimeout;
|
||||
const maxHeadersCount: number | null = server.maxHeadersCount;
|
||||
const headersTimeout: number = server.headersTimeout;
|
||||
server.setTimeout().setTimeout(1000).setTimeout(() => {}).setTimeout(100, () => {});
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/// Timers tests : https://nodejs.org/api/timers.html
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const immediate = timers
|
||||
.setImmediate(() => {
|
||||
console.log('immediate');
|
||||
})
|
||||
.unref()
|
||||
.ref();
|
||||
const b: boolean = immediate.hasRef();
|
||||
timers.clearImmediate(immediate);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setInterval(() => {
|
||||
console.log('interval');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearInterval(timeout);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setTimeout(() => {
|
||||
console.log('timeout');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearTimeout(timeout);
|
||||
}
|
||||
async function testPromisify() {
|
||||
const setTimeout = util.promisify(timers.setTimeout);
|
||||
let v: void = await setTimeout(100); // tslint:disable-line no-void-expression void-return
|
||||
let s: string = await setTimeout(100, "");
|
||||
|
||||
const setImmediate = util.promisify(timers.setImmediate);
|
||||
v = await setImmediate(); // tslint:disable-line no-void-expression
|
||||
s = await setImmediate("");
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
/// Errors Tests : https://nodejs.org/api/errors.html ///
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
Error.stackTraceLimit = Infinity;
|
||||
}
|
||||
{
|
||||
const myObject = {};
|
||||
Error.captureStackTrace(myObject);
|
||||
}
|
||||
{
|
||||
const frames: NodeJS.CallSite[] = [];
|
||||
Error.prepareStackTrace!(new Error(), frames);
|
||||
}
|
||||
{
|
||||
const frame: NodeJS.CallSite = null!;
|
||||
const frameThis: any = frame.getThis();
|
||||
const typeName: string | null = frame.getTypeName();
|
||||
const func: Function | undefined = frame.getFunction();
|
||||
const funcName: string | null = frame.getFunctionName();
|
||||
const meth: string | null = frame.getMethodName();
|
||||
const fname: string | null = frame.getFileName();
|
||||
const lineno: number | null = frame.getLineNumber();
|
||||
const colno: number | null = frame.getColumnNumber();
|
||||
const evalOrigin: string | undefined = frame.getEvalOrigin();
|
||||
const isTop: boolean = frame.isToplevel();
|
||||
const isEval: boolean = frame.isEval();
|
||||
const isNative: boolean = frame.isNative();
|
||||
const isConstr: boolean = frame.isConstructor();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Console Tests : https://nodejs.org/api/console.html ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
let _c: Console = console;
|
||||
_c = console2;
|
||||
}
|
||||
{
|
||||
const writeStream = fs.createWriteStream('./index.d.ts');
|
||||
let consoleInstance: Console = new console.Console(writeStream);
|
||||
|
||||
consoleInstance = new console.Console(writeStream, writeStream);
|
||||
consoleInstance = new console.Console(writeStream, writeStream, true);
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
stderr: writeStream,
|
||||
colorMode: 'auto',
|
||||
ignoreErrors: true
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
colorMode: false
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream
|
||||
});
|
||||
}
|
||||
{
|
||||
console.assert('value');
|
||||
console.assert('value', 'message');
|
||||
console.assert('value', 'message', 'foo', 'bar');
|
||||
console.clear();
|
||||
console.count();
|
||||
console.count('label');
|
||||
console.countReset();
|
||||
console.countReset('label');
|
||||
console.debug();
|
||||
console.debug('message');
|
||||
console.debug('message', 'foo', 'bar');
|
||||
console.dir('obj');
|
||||
console.dir('obj', { depth: 1 });
|
||||
console.error();
|
||||
console.error('message');
|
||||
console.error('message', 'foo', 'bar');
|
||||
console.group();
|
||||
console.group('label');
|
||||
console.group('label1', 'label2');
|
||||
console.groupCollapsed();
|
||||
console.groupEnd();
|
||||
console.info();
|
||||
console.info('message');
|
||||
console.info('message', 'foo', 'bar');
|
||||
console.log();
|
||||
console.log('message');
|
||||
console.log('message', 'foo', 'bar');
|
||||
console.table({ foo: 'bar' });
|
||||
console.table([{ foo: 'bar' }]);
|
||||
console.table([{ foo: 'bar' }], ['foo']);
|
||||
console.time();
|
||||
console.time('label');
|
||||
console.timeEnd();
|
||||
console.timeEnd('label');
|
||||
console.timeLog();
|
||||
console.timeLog('label');
|
||||
console.timeLog('label', 'foo', 'bar');
|
||||
console.trace();
|
||||
console.trace('message');
|
||||
console.trace('message', 'foo', 'bar');
|
||||
console.warn();
|
||||
console.warn('message');
|
||||
console.warn('message', 'foo', 'bar');
|
||||
|
||||
// --- Inspector mode only ---
|
||||
console.markTimeline();
|
||||
console.markTimeline('label');
|
||||
console.profile();
|
||||
console.profile('label');
|
||||
console.profileEnd();
|
||||
console.profileEnd('label');
|
||||
console.timeStamp();
|
||||
console.timeStamp('label');
|
||||
console.timeline();
|
||||
console.timeline('label');
|
||||
console.timelineEnd();
|
||||
console.timelineEnd('label');
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
/// DNS Tests : https://nodejs.org/api/dns.html ///
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
dns.lookup("nodejs.org", (err, address, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: string = address;
|
||||
const _family: number = family;
|
||||
});
|
||||
dns.lookup("nodejs.org", 4, (err, address, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: string = address;
|
||||
const _family: number = family;
|
||||
});
|
||||
dns.lookup("nodejs.org", 6, (err, address, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: string = address;
|
||||
const _family: number = family;
|
||||
});
|
||||
dns.lookup("nodejs.org", {}, (err, address, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: string = address;
|
||||
const _family: number = family;
|
||||
});
|
||||
dns.lookup(
|
||||
"nodejs.org",
|
||||
{
|
||||
family: 4,
|
||||
hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
||||
all: false
|
||||
},
|
||||
(err, address, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: string = address;
|
||||
const _family: number = family;
|
||||
}
|
||||
);
|
||||
dns.lookup("nodejs.org", { all: true }, (err, addresses) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: dns.LookupAddress[] = addresses;
|
||||
});
|
||||
dns.lookup("nodejs.org", { all: true, verbatim: true }, (err, addresses) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: dns.LookupAddress[] = addresses;
|
||||
});
|
||||
|
||||
function trueOrFalse(): boolean {
|
||||
return Math.random() > 0.5 ? true : false;
|
||||
}
|
||||
dns.lookup("nodejs.org", { all: trueOrFalse() }, (err, addresses, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _addresses: string | dns.LookupAddress[] = addresses;
|
||||
const _family: number | undefined = family;
|
||||
});
|
||||
|
||||
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _hostname: string = hostname;
|
||||
const _service: string = service;
|
||||
});
|
||||
|
||||
dns.resolve("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "A", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "AAAA", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "ANY", (err, addresses) => {
|
||||
const _addresses: dns.AnyRecord[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "MX", (err, addresses) => {
|
||||
const _addresses: dns.MxRecord[] = addresses;
|
||||
});
|
||||
|
||||
dns.resolve4("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve4("nodejs.org", { ttl: true }, (err, addresses) => {
|
||||
const _addresses: dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
{
|
||||
const ttl = false;
|
||||
dns.resolve4("nodejs.org", { ttl }, (err, addresses) => {
|
||||
const _addresses: string[] | dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
}
|
||||
|
||||
dns.resolve6("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve6("nodejs.org", { ttl: true }, (err, addresses) => {
|
||||
const _addresses: dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
{
|
||||
const ttl = false;
|
||||
dns.resolve6("nodejs.org", { ttl }, (err, addresses) => {
|
||||
const _addresses: string[] | dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
}
|
||||
{
|
||||
const resolver = new dns.Resolver();
|
||||
resolver.setServers(["4.4.4.4"]);
|
||||
resolver.resolve("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
resolver.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* The following tests are the modules not mentioned in document but existed *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Constants Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
import * as constants from 'constants';
|
||||
{
|
||||
let str: string;
|
||||
let num: number;
|
||||
num = constants.SIGHUP;
|
||||
num = constants.SIGINT;
|
||||
num = constants.SIGQUIT;
|
||||
num = constants.SIGILL;
|
||||
num = constants.SIGTRAP;
|
||||
num = constants.SIGABRT;
|
||||
num = constants.SIGIOT;
|
||||
num = constants.SIGBUS;
|
||||
num = constants.SIGFPE;
|
||||
num = constants.SIGKILL;
|
||||
num = constants.SIGUSR1;
|
||||
num = constants.SIGSEGV;
|
||||
num = constants.SIGUSR2;
|
||||
num = constants.SIGPIPE;
|
||||
num = constants.SIGALRM;
|
||||
num = constants.SIGTERM;
|
||||
num = constants.SIGCHLD;
|
||||
num = constants.SIGSTKFLT;
|
||||
num = constants.SIGCONT;
|
||||
num = constants.SIGSTOP;
|
||||
num = constants.SIGTSTP;
|
||||
num = constants.SIGTTIN;
|
||||
num = constants.SIGTTOU;
|
||||
num = constants.SIGURG;
|
||||
num = constants.SIGXCPU;
|
||||
num = constants.SIGXFSZ;
|
||||
num = constants.SIGVTALRM;
|
||||
num = constants.SIGPROF;
|
||||
num = constants.SIGWINCH;
|
||||
num = constants.SIGIO;
|
||||
num = constants.SIGPOLL;
|
||||
num = constants.SIGPWR;
|
||||
num = constants.SIGSYS;
|
||||
num = constants.SIGUNUSED;
|
||||
num = constants.O_RDONLY;
|
||||
num = constants.O_WRONLY;
|
||||
num = constants.O_RDWR;
|
||||
num = constants.S_IFMT;
|
||||
num = constants.S_IFREG;
|
||||
num = constants.S_IFDIR;
|
||||
num = constants.S_IFCHR;
|
||||
num = constants.S_IFBLK;
|
||||
num = constants.S_IFIFO;
|
||||
num = constants.S_IFLNK;
|
||||
num = constants.S_IFSOCK;
|
||||
num = constants.O_CREAT;
|
||||
num = constants.O_EXCL;
|
||||
num = constants.O_NOCTTY;
|
||||
num = constants.O_TRUNC;
|
||||
num = constants.O_APPEND;
|
||||
num = constants.O_DIRECTORY;
|
||||
num = constants.O_NOATIME;
|
||||
num = constants.O_NOFOLLOW;
|
||||
num = constants.O_SYNC;
|
||||
num = constants.O_DSYNC;
|
||||
num = constants.O_DIRECT;
|
||||
num = constants.O_NONBLOCK;
|
||||
num = constants.S_IRWXU;
|
||||
num = constants.S_IRUSR;
|
||||
num = constants.S_IWUSR;
|
||||
num = constants.S_IXUSR;
|
||||
num = constants.S_IRWXG;
|
||||
num = constants.S_IRGRP;
|
||||
num = constants.S_IWGRP;
|
||||
num = constants.S_IXGRP;
|
||||
num = constants.S_IRWXO;
|
||||
num = constants.S_IROTH;
|
||||
num = constants.S_IWOTH;
|
||||
num = constants.S_IXOTH;
|
||||
num = constants.F_OK;
|
||||
num = constants.R_OK;
|
||||
num = constants.W_OK;
|
||||
num = constants.X_OK;
|
||||
num = constants.SSL_OP_ALL;
|
||||
num = constants.SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION;
|
||||
num = constants.SSL_OP_CIPHER_SERVER_PREFERENCE;
|
||||
num = constants.SSL_OP_CISCO_ANYCONNECT;
|
||||
num = constants.SSL_OP_COOKIE_EXCHANGE;
|
||||
num = constants.SSL_OP_CRYPTOPRO_TLSEXT_BUG;
|
||||
num = constants.SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
|
||||
num = constants.SSL_OP_EPHEMERAL_RSA;
|
||||
num = constants.SSL_OP_LEGACY_SERVER_CONNECT;
|
||||
num = constants.SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER;
|
||||
num = constants.SSL_OP_MICROSOFT_SESS_ID_BUG;
|
||||
num = constants.SSL_OP_MSIE_SSLV2_RSA_PADDING;
|
||||
num = constants.SSL_OP_NETSCAPE_CA_DN_BUG;
|
||||
num = constants.SSL_OP_NETSCAPE_CHALLENGE_BUG;
|
||||
num = constants.SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG;
|
||||
num = constants.SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG;
|
||||
num = constants.SSL_OP_NO_COMPRESSION;
|
||||
num = constants.SSL_OP_NO_QUERY_MTU;
|
||||
num = constants.SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION;
|
||||
num = constants.SSL_OP_NO_SSLv2;
|
||||
num = constants.SSL_OP_NO_SSLv3;
|
||||
num = constants.SSL_OP_NO_TICKET;
|
||||
num = constants.SSL_OP_NO_TLSv1;
|
||||
num = constants.SSL_OP_NO_TLSv1_1;
|
||||
num = constants.SSL_OP_NO_TLSv1_2;
|
||||
num = constants.SSL_OP_PKCS1_CHECK_1;
|
||||
num = constants.SSL_OP_PKCS1_CHECK_2;
|
||||
num = constants.SSL_OP_SINGLE_DH_USE;
|
||||
num = constants.SSL_OP_SINGLE_ECDH_USE;
|
||||
num = constants.SSL_OP_SSLEAY_080_CLIENT_DH_BUG;
|
||||
num = constants.SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG;
|
||||
num = constants.SSL_OP_TLS_BLOCK_PADDING_BUG;
|
||||
num = constants.SSL_OP_TLS_D5_BUG;
|
||||
num = constants.SSL_OP_TLS_ROLLBACK_BUG;
|
||||
num = constants.ENGINE_METHOD_RSA;
|
||||
num = constants.ENGINE_METHOD_DSA;
|
||||
num = constants.ENGINE_METHOD_DH;
|
||||
num = constants.ENGINE_METHOD_RAND;
|
||||
num = constants.ENGINE_METHOD_ECDH;
|
||||
num = constants.ENGINE_METHOD_ECDSA;
|
||||
num = constants.ENGINE_METHOD_CIPHERS;
|
||||
num = constants.ENGINE_METHOD_DIGESTS;
|
||||
num = constants.ENGINE_METHOD_STORE;
|
||||
num = constants.ENGINE_METHOD_PKEY_METHS;
|
||||
num = constants.ENGINE_METHOD_PKEY_ASN1_METHS;
|
||||
num = constants.ENGINE_METHOD_ALL;
|
||||
num = constants.ENGINE_METHOD_NONE;
|
||||
num = constants.DH_CHECK_P_NOT_SAFE_PRIME;
|
||||
num = constants.DH_CHECK_P_NOT_PRIME;
|
||||
num = constants.DH_UNABLE_TO_CHECK_GENERATOR;
|
||||
num = constants.DH_NOT_SUITABLE_GENERATOR;
|
||||
num = constants.ALPN_ENABLED;
|
||||
num = constants.RSA_PKCS1_PADDING;
|
||||
num = constants.RSA_SSLV23_PADDING;
|
||||
num = constants.RSA_NO_PADDING;
|
||||
num = constants.RSA_PKCS1_OAEP_PADDING;
|
||||
num = constants.RSA_X931_PADDING;
|
||||
num = constants.RSA_PKCS1_PSS_PADDING;
|
||||
num = constants.POINT_CONVERSION_COMPRESSED;
|
||||
num = constants.POINT_CONVERSION_UNCOMPRESSED;
|
||||
num = constants.POINT_CONVERSION_HYBRID;
|
||||
str = constants.defaultCoreCipherList;
|
||||
str = constants.defaultCipherList;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Inspector Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const b: inspector.Console.ConsoleMessage = {source: 'test', text: 'test', level: 'error' };
|
||||
inspector.open();
|
||||
inspector.open(0);
|
||||
inspector.open(0, 'localhost');
|
||||
inspector.open(0, 'localhost', true);
|
||||
inspector.close();
|
||||
const inspectorUrl: string | undefined = inspector.url();
|
||||
|
||||
const session = new inspector.Session();
|
||||
session.connect();
|
||||
session.disconnect();
|
||||
|
||||
// Unknown post method
|
||||
session.post('A.b', { key: 'value' }, (err, params) => {});
|
||||
// TODO: parameters are implicitly 'any' and need type annotation
|
||||
session.post('A.b', (err: Error | null, params?: {}) => {});
|
||||
session.post('A.b');
|
||||
// Known post method
|
||||
const parameter: inspector.Runtime.EvaluateParameterType = { expression: '2 + 2' };
|
||||
session.post('Runtime.evaluate', parameter,
|
||||
(err: Error | null, params: inspector.Runtime.EvaluateReturnType) => {});
|
||||
session.post('Runtime.evaluate', (err: Error, params: inspector.Runtime.EvaluateReturnType) => {
|
||||
const exceptionDetails: inspector.Runtime.ExceptionDetails = params.exceptionDetails!;
|
||||
const resultClassName: string = params.result.className!;
|
||||
});
|
||||
session.post('Runtime.evaluate');
|
||||
|
||||
// General event
|
||||
session.on('inspectorNotification', message => {
|
||||
message; // $ExpectType InspectorNotification<{}>
|
||||
});
|
||||
// Known events
|
||||
session.on('Debugger.paused', (message: inspector.InspectorNotification<inspector.Debugger.PausedEventDataType>) => {
|
||||
const method: string = message.method;
|
||||
const pauseReason: string = message.params.reason;
|
||||
});
|
||||
session.on('Debugger.resumed', () => {});
|
||||
// Node Inspector events
|
||||
session.on('NodeTracing.dataCollected', (message: inspector.InspectorNotification<inspector.NodeTracing.DataCollectedEventDataType>) => {
|
||||
const value: Array<{}> = message.params.value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Trace Events Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const enabledCategories: string | undefined = trace_events.getEnabledCategories();
|
||||
const tracing: trace_events.Tracing = trace_events.createTracing({ categories: ['node', 'v8'] });
|
||||
const categories: string = tracing.categories;
|
||||
const enabled: boolean = tracing.enabled;
|
||||
tracing.enable();
|
||||
tracing.disable();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// module tests : http://nodejs.org/api/modules.html
|
||||
////////////////////////////////////////////////////
|
||||
import moduleModule = require('module');
|
||||
|
||||
{
|
||||
require.extensions[".ts"] = () => "";
|
||||
|
||||
Module.runMain();
|
||||
const s: string = Module.wrap("some code");
|
||||
|
||||
const m1: Module = new Module("moduleId");
|
||||
const m2: Module = new Module.Module("moduleId");
|
||||
const b: string[] = Module.builtinModules;
|
||||
let paths: string[] = module.paths;
|
||||
const path: string = module.path;
|
||||
paths = m1.paths;
|
||||
|
||||
const customRequire1 = moduleModule.createRequireFromPath('./test');
|
||||
const customRequire2 = moduleModule.createRequire('./test');
|
||||
|
||||
customRequire1('test');
|
||||
customRequire2('test');
|
||||
|
||||
const resolved1: string = customRequire1.resolve('test');
|
||||
const resolved2: string = customRequire2.resolve('test');
|
||||
|
||||
const paths1: string[] | null = customRequire1.resolve.paths('test');
|
||||
const paths2: string[] | null = customRequire2.resolve.paths('test');
|
||||
|
||||
const cachedModule1: Module = customRequire1.cache['/path/to/module.js'];
|
||||
const cachedModule2: Module = customRequire2.cache['/path/to/module.js'];
|
||||
|
||||
const main1: Module | undefined = customRequire1.main;
|
||||
const main2: Module | undefined = customRequire2.main;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
/// stream tests : https://nodejs.org/api/stream.html ///
|
||||
/////////////////////////////////////////////////////////
|
||||
import stream = require('stream');
|
||||
import tty = require('tty');
|
||||
|
||||
{
|
||||
const writeStream = fs.createWriteStream('./index.d.ts');
|
||||
const _wom = writeStream.writableObjectMode; // $ExpectType boolean
|
||||
|
||||
const readStream = fs.createReadStream('./index.d.ts');
|
||||
const _rom = readStream.readableObjectMode; // $ExpectType boolean
|
||||
|
||||
const x: stream.Readable = process.stdin;
|
||||
const stdin: tty.ReadStream = process.stdin;
|
||||
const stdout: tty.WriteStream = process.stdout;
|
||||
const stderr: tty.WriteStream = process.stderr;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
/// dgram tests : https://nodejs.org/api/dgram.html ///
|
||||
/////////////////////////////////////////////////////////
|
||||
{
|
||||
let sock: dgram.Socket = dgram.createSocket("udp4");
|
||||
sock = dgram.createSocket({ type: "udp4" });
|
||||
sock = dgram.createSocket({
|
||||
type: "udp4",
|
||||
reuseAddr: true,
|
||||
ipv6Only: false,
|
||||
recvBufferSize: 4096,
|
||||
sendBufferSize: 4096,
|
||||
lookup: dns.lookup,
|
||||
});
|
||||
sock = dgram.createSocket("udp6", (msg, rinfo) => {
|
||||
msg; // $ExpectType Buffer
|
||||
rinfo; // $ExpectType RemoteInfo
|
||||
});
|
||||
sock.addMembership("233.252.0.0");
|
||||
sock.addMembership("233.252.0.0", "192.0.2.1");
|
||||
sock.address().address; // $ExpectType string
|
||||
sock.address().family; // $ExpectType string
|
||||
sock.address().port; // $ExpectType number
|
||||
sock.bind();
|
||||
sock.bind(() => undefined);
|
||||
sock.bind(8000);
|
||||
sock.bind(8000, () => undefined);
|
||||
sock.bind(8000, "192.0.2.1");
|
||||
sock.bind(8000, "192.0.2.1", () => undefined);
|
||||
sock.bind({}, () => undefined);
|
||||
sock.bind({ port: 8000, address: "192.0.2.1", exclusive: true });
|
||||
sock.bind({ fd: 7, exclusive: true });
|
||||
sock.close();
|
||||
sock.close(() => undefined);
|
||||
sock.connect(8000);
|
||||
sock.connect(8000, "192.0.2.1");
|
||||
sock.connect(8000, () => undefined);
|
||||
sock.connect(8000, "192.0.2.1", () => undefined);
|
||||
sock.disconnect();
|
||||
sock.dropMembership("233.252.0.0");
|
||||
sock.dropMembership("233.252.0.0", "192.0.2.1");
|
||||
sock.getRecvBufferSize(); // $ExpectType number
|
||||
sock.getSendBufferSize(); // $ExpectType number
|
||||
sock = sock.ref();
|
||||
sock.remoteAddress().address; // $ExpectType string
|
||||
sock.remoteAddress().family; // $ExpectType string
|
||||
sock.remoteAddress().port; // $ExpectType number
|
||||
sock.send("datagram");
|
||||
sock.send(new Uint8Array(256), 8000, (err) => {
|
||||
err; // $ExpectType Error | null
|
||||
});
|
||||
sock.send(Buffer.alloc(256), 8000, "192.0.2.1");
|
||||
sock.send(new Uint8Array(256), 128, 64);
|
||||
sock.send("datagram", 128, 64, (err) => undefined);
|
||||
sock.send(new Uint8Array(256), 128, 64, 8000);
|
||||
sock.send(new Uint8Array(256), 128, 64, 8000, (err) => undefined);
|
||||
sock.send(Buffer.alloc(256), 128, 64, 8000, "192.0.2.1");
|
||||
sock.send("datagram", 128, 64, 8000, "192.0.2.1", (err) => undefined);
|
||||
sock.setBroadcast(true);
|
||||
sock.setMulticastInterface("192.0.2.1");
|
||||
sock.setMulticastLoopback(false);
|
||||
sock.setMulticastTTL(128);
|
||||
sock.setRecvBufferSize(4096);
|
||||
sock.setSendBufferSize(4096);
|
||||
sock.setTTL(128);
|
||||
sock = sock.unref();
|
||||
|
||||
sock.on("close", () => undefined);
|
||||
sock.on("connect", () => undefined);
|
||||
sock.on("error", (exception) => {
|
||||
exception; // $ExpectType Error
|
||||
});
|
||||
sock.on("listening", () => undefined);
|
||||
sock.on("message", (msg, rinfo) => {
|
||||
msg; // $ExpectType Buffer
|
||||
rinfo.address; // $ExpectType string
|
||||
rinfo.family; // $ExpectType "IPv4" | "IPv6"
|
||||
rinfo.port; // $ExpectType number
|
||||
rinfo.size; // $ExpectType number
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Node.js ESNEXT Support
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const s = 'foo';
|
||||
const s1: string = s.trimLeft();
|
||||
const s2: string = s.trimRight();
|
||||
const s3: string = s.trimStart();
|
||||
const s4: string = s.trimEnd();
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "esnext",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../../",
|
||||
"typeRoots": [
|
||||
"../../../"
|
||||
],
|
||||
"paths": {
|
||||
"node": [
|
||||
"node/v12"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"no-bad-reference": false,
|
||||
"no-empty-interface": false,
|
||||
"no-single-declare-module": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
181
types/node/v12/ts3.1/util.d.ts
vendored
181
types/node/v12/ts3.1/util.d.ts
vendored
@ -1,181 +0,0 @@
|
||||
declare module "util" {
|
||||
interface InspectOptions extends NodeJS.InspectOptions { }
|
||||
function format(format: any, ...param: any[]): string;
|
||||
function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
|
||||
/** @deprecated since v0.11.3 - use a third party module instead. */
|
||||
function log(string: string): void;
|
||||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
function inspect(object: any, options: InspectOptions): string;
|
||||
namespace inspect {
|
||||
let colors: {
|
||||
[color: string]: [number, number] | undefined
|
||||
};
|
||||
let styles: {
|
||||
[style: string]: string | undefined
|
||||
};
|
||||
let defaultOptions: InspectOptions;
|
||||
/**
|
||||
* Allows changing inspect settings from the repl.
|
||||
*/
|
||||
let replDefaults: InspectOptions;
|
||||
}
|
||||
/** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
|
||||
function isArray(object: any): object is any[];
|
||||
/** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
|
||||
function isDate(object: any): object is Date;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
|
||||
function isError(object: any): object is Error;
|
||||
function inherits(constructor: any, superConstructor: any): void;
|
||||
function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
|
||||
function isBoolean(object: any): object is boolean;
|
||||
/** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
|
||||
function isBuffer(object: any): object is Buffer;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
|
||||
function isFunction(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `value === null` instead. */
|
||||
function isNull(object: any): object is null;
|
||||
/** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
|
||||
function isNullOrUndefined(object: any): object is null | undefined;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
|
||||
function isNumber(object: any): object is number;
|
||||
/** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
|
||||
function isObject(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
|
||||
function isPrimitive(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
|
||||
function isString(object: any): object is string;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
|
||||
function isSymbol(object: any): object is symbol;
|
||||
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
|
||||
function isUndefined(object: any): object is undefined;
|
||||
function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
|
||||
function isDeepStrictEqual(val1: any, val2: any): boolean;
|
||||
|
||||
interface CustomPromisify<TCustom extends Function> extends Function {
|
||||
__promisify__: TCustom;
|
||||
}
|
||||
|
||||
function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
|
||||
function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
||||
function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
|
||||
function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
||||
function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
||||
function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
||||
function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
||||
function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
||||
function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
function promisify(fn: Function): Function;
|
||||
|
||||
namespace types {
|
||||
function isAnyArrayBuffer(object: any): boolean;
|
||||
function isArgumentsObject(object: any): object is IArguments;
|
||||
function isArrayBuffer(object: any): object is ArrayBuffer;
|
||||
function isArrayBufferView(object: any): object is ArrayBufferView;
|
||||
function isAsyncFunction(object: any): boolean;
|
||||
function isBooleanObject(object: any): object is Boolean;
|
||||
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
|
||||
function isDataView(object: any): object is DataView;
|
||||
function isDate(object: any): object is Date;
|
||||
function isExternal(object: any): boolean;
|
||||
function isFloat32Array(object: any): object is Float32Array;
|
||||
function isFloat64Array(object: any): object is Float64Array;
|
||||
function isGeneratorFunction(object: any): boolean;
|
||||
function isGeneratorObject(object: any): boolean;
|
||||
function isInt8Array(object: any): object is Int8Array;
|
||||
function isInt16Array(object: any): object is Int16Array;
|
||||
function isInt32Array(object: any): object is Int32Array;
|
||||
function isMap(object: any): boolean;
|
||||
function isMapIterator(object: any): boolean;
|
||||
function isModuleNamespaceObject(value: any): boolean;
|
||||
function isNativeError(object: any): object is Error;
|
||||
function isNumberObject(object: any): object is Number;
|
||||
function isPromise(object: any): boolean;
|
||||
function isProxy(object: any): boolean;
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
function isSet(object: any): boolean;
|
||||
function isSetIterator(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): boolean;
|
||||
function isStringObject(object: any): boolean;
|
||||
function isSymbolObject(object: any): boolean;
|
||||
function isTypedArray(object: any): object is NodeJS.TypedArray;
|
||||
function isUint8Array(object: any): object is Uint8Array;
|
||||
function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
||||
function isUint16Array(object: any): object is Uint16Array;
|
||||
function isUint32Array(object: any): object is Uint32Array;
|
||||
function isWeakMap(object: any): boolean;
|
||||
function isWeakSet(object: any): boolean;
|
||||
function isWebAssemblyCompiledModule(object: any): boolean;
|
||||
}
|
||||
|
||||
class TextDecoder {
|
||||
readonly encoding: string;
|
||||
readonly fatal: boolean;
|
||||
readonly ignoreBOM: boolean;
|
||||
constructor(
|
||||
encoding?: string,
|
||||
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
||||
);
|
||||
decode(
|
||||
input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
||||
options?: { stream?: boolean }
|
||||
): string;
|
||||
}
|
||||
|
||||
interface EncodeIntoResult {
|
||||
/**
|
||||
* The read Unicode code units of input.
|
||||
*/
|
||||
|
||||
read: number;
|
||||
/**
|
||||
* The written UTF-8 bytes of output.
|
||||
*/
|
||||
written: number;
|
||||
}
|
||||
|
||||
class TextEncoder {
|
||||
readonly encoding: string;
|
||||
encode(input?: string): Uint8Array;
|
||||
encodeInto(input: string, output: Uint8Array): EncodeIntoResult;
|
||||
}
|
||||
}
|
||||
44
types/node/v12/ts3.3/base.d.ts
vendored
44
types/node/v12/ts3.3/base.d.ts
vendored
@ -13,10 +13,42 @@
|
||||
/// <reference lib="esnext.bigint" />
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/base.d.ts" />
|
||||
|
||||
// TypeScript 3.2-specific augmentations:
|
||||
/// <reference path="../fs.d.ts" />
|
||||
/// <reference path="../util.d.ts" />
|
||||
/// <reference path="../globals.d.ts" />
|
||||
/// <reference path="../async_hooks.d.ts" />
|
||||
/// <reference path="../buffer.d.ts" />
|
||||
/// <reference path="../child_process.d.ts" />
|
||||
/// <reference path="../cluster.d.ts" />
|
||||
/// <reference path="../console.d.ts" />
|
||||
/// <reference path="../constants.d.ts" />
|
||||
/// <reference path="../crypto.d.ts" />
|
||||
/// <reference path="../dgram.d.ts" />
|
||||
/// <reference path="../dns.d.ts" />
|
||||
/// <reference path="../domain.d.ts" />
|
||||
/// <reference path="../events.d.ts" />
|
||||
/// <reference path="../fs.d.ts" />
|
||||
/// <reference path="../http.d.ts" />
|
||||
/// <reference path="../http2.d.ts" />
|
||||
/// <reference path="../https.d.ts" />
|
||||
/// <reference path="../inspector.d.ts" />
|
||||
/// <reference path="../module.d.ts" />
|
||||
/// <reference path="../net.d.ts" />
|
||||
/// <reference path="../os.d.ts" />
|
||||
/// <reference path="../path.d.ts" />
|
||||
/// <reference path="../perf_hooks.d.ts" />
|
||||
/// <reference path="../process.d.ts" />
|
||||
/// <reference path="../punycode.d.ts" />
|
||||
/// <reference path="../querystring.d.ts" />
|
||||
/// <reference path="../readline.d.ts" />
|
||||
/// <reference path="../repl.d.ts" />
|
||||
/// <reference path="../stream.d.ts" />
|
||||
/// <reference path="../string_decoder.d.ts" />
|
||||
/// <reference path="../timers.d.ts" />
|
||||
/// <reference path="../tls.d.ts" />
|
||||
/// <reference path="../trace_events.d.ts" />
|
||||
/// <reference path="../tty.d.ts" />
|
||||
/// <reference path="../url.d.ts" />
|
||||
/// <reference path="../util.d.ts" />
|
||||
/// <reference path="../v8.d.ts" />
|
||||
/// <reference path="../vm.d.ts" />
|
||||
/// <reference path="../worker_threads.d.ts" />
|
||||
/// <reference path="../zlib.d.ts" />
|
||||
|
||||
8
types/node/v12/ts3.3/index.d.ts
vendored
8
types/node/v12/ts3.3/index.d.ts
vendored
@ -4,9 +4,5 @@
|
||||
// Typically type modifiations should be made in base.d.ts instead of here
|
||||
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/assert.d.ts" />
|
||||
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/globals.global.d.ts" />
|
||||
/// <reference path="assert.d.ts" />
|
||||
/// <reference path="globals.global.d.ts" />
|
||||
|
||||
@ -1,31 +1,903 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
import '../ts3.1/node-tests';
|
||||
import '../ts3.1/assert';
|
||||
import '../ts3.1/buffer';
|
||||
import '../ts3.1/child_process';
|
||||
import '../ts3.1/cluster';
|
||||
import '../ts3.1/crypto';
|
||||
import '../ts3.1/dgram';
|
||||
import '../ts3.1/global';
|
||||
import '../ts3.1/http';
|
||||
import '../ts3.1/http2';
|
||||
import '../ts3.1/net';
|
||||
import '../ts3.1/os';
|
||||
import '../ts3.1/path';
|
||||
import '../ts3.1/perf_hooks';
|
||||
import '../ts3.1/process';
|
||||
import '../ts3.1/querystring';
|
||||
import '../ts3.1/readline';
|
||||
import '../ts3.1/repl';
|
||||
import '../ts3.1/stream';
|
||||
import '../ts3.1/tls';
|
||||
import '../ts3.1/tty';
|
||||
import '../ts3.1/util';
|
||||
import '../ts3.1/worker_threads';
|
||||
import '../ts3.1/zlib';
|
||||
import assert = require("assert");
|
||||
import * as fs from "fs";
|
||||
import * as url from "url";
|
||||
import * as util from "util";
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
import * as console2 from "console";
|
||||
import * as timers from "timers";
|
||||
import * as dns from "dns";
|
||||
import * as inspector from "inspector";
|
||||
import * as trace_events from "trace_events";
|
||||
import * as dgram from "dgram";
|
||||
import Module = require("module");
|
||||
|
||||
import { types, promisify } from 'util';
|
||||
import { BigIntStats, statSync, Stats } from 'fs';
|
||||
////////////////////////////////////////////////////
|
||||
/// Url tests : http://nodejs.org/api/url.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
url.format(url.parse('http://www.example.com/xyz'));
|
||||
|
||||
url.format('http://www.example.com/xyz');
|
||||
|
||||
// https://google.com/search?q=you're%20a%20lizard%2C%20gary
|
||||
url.format({
|
||||
protocol: 'https',
|
||||
host: "google.com",
|
||||
pathname: 'search',
|
||||
query: { q: "you're a lizard, gary" }
|
||||
});
|
||||
|
||||
const myURL = new url.URL('https://a:b@你好你好?abc#foo');
|
||||
url.format(myURL, { fragment: false, unicode: true, auth: false });
|
||||
}
|
||||
|
||||
{
|
||||
const helloUrl = url.parse('http://example.com/?hello=world', true);
|
||||
let helloQuery = helloUrl.query['hello'];
|
||||
assert.equal(helloUrl.query['hello'], 'world');
|
||||
|
||||
let strUrl = url.parse('http://example.com/?hello=world');
|
||||
let queryStr: string = strUrl.query!;
|
||||
|
||||
strUrl = url.parse('http://example.com/?hello=world', false);
|
||||
queryStr = strUrl.query!;
|
||||
|
||||
function getBoolean(): boolean { return false; }
|
||||
const urlUrl = url.parse('http://example.com/?hello=world', getBoolean());
|
||||
if (typeof(urlUrl.query) === 'string') {
|
||||
queryStr = urlUrl.query;
|
||||
} else if (urlUrl.query) {
|
||||
helloQuery = urlUrl.query['hello'];
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const ascii: string = url.domainToASCII('español.com');
|
||||
const unicode: string = url.domainToUnicode('xn--espaol-zwa.com');
|
||||
}
|
||||
|
||||
{
|
||||
let myURL = new url.URL('https://theuser:thepwd@example.org:81/foo/path?query=string#bar');
|
||||
assert.equal(myURL.hash, '#bar');
|
||||
assert.equal(myURL.host, 'example.org:81');
|
||||
assert.equal(myURL.hostname, 'example.org');
|
||||
assert.equal(myURL.href, 'https://theuser:thepwd@example.org:81/foo/path?query=string#bar');
|
||||
assert.equal(myURL.origin, 'https://example.org:81');
|
||||
assert.equal(myURL.password, 'thepwd');
|
||||
assert.equal(myURL.username, 'theuser');
|
||||
assert.equal(myURL.pathname, '/foo/path');
|
||||
assert.equal(myURL.port, "81");
|
||||
assert.equal(myURL.protocol, "https:");
|
||||
assert.equal(myURL.search, "?query=string");
|
||||
assert.equal(myURL.toString(), 'https://theuser:thepwd@example.org:81/foo/path?query=string#bar');
|
||||
assert(myURL.searchParams instanceof url.URLSearchParams);
|
||||
|
||||
myURL.host = 'example.org:82';
|
||||
myURL.hostname = 'example.com';
|
||||
myURL.href = 'http://other.com';
|
||||
myURL.hash = 'baz';
|
||||
myURL.password = "otherpwd";
|
||||
myURL.username = "otheruser";
|
||||
myURL.pathname = "/otherPath";
|
||||
myURL.port = "82";
|
||||
myURL.protocol = "http";
|
||||
myURL.search = "a=b";
|
||||
assert.equal(myURL.href, 'http://otheruser:otherpwd@other.com:82/otherPath?a=b#baz');
|
||||
|
||||
myURL = new url.URL('/foo', 'https://example.org/');
|
||||
assert.equal(myURL.href, 'https://example.org/foo');
|
||||
assert.equal(myURL.toJSON(), myURL.href);
|
||||
}
|
||||
|
||||
{
|
||||
const searchParams = new url.URLSearchParams('abc=123');
|
||||
|
||||
assert.equal(searchParams.toString(), 'abc=123');
|
||||
searchParams.forEach((value: string, name: string, me: url.URLSearchParams): void => {
|
||||
assert.equal(name, 'abc');
|
||||
assert.equal(value, '123');
|
||||
assert.equal(me, searchParams);
|
||||
});
|
||||
|
||||
assert.equal(searchParams.get('abc'), '123');
|
||||
|
||||
searchParams.append('abc', 'xyz');
|
||||
|
||||
assert.deepEqual(searchParams.getAll('abc'), ['123', 'xyz']);
|
||||
|
||||
const entries = searchParams.entries();
|
||||
assert.deepEqual(entries.next(), { value: ["abc", "123"], done: false });
|
||||
assert.deepEqual(entries.next(), { value: ["abc", "xyz"], done: false });
|
||||
assert.deepEqual(entries.next(), { value: undefined, done: true });
|
||||
|
||||
const keys = searchParams.keys();
|
||||
assert.deepEqual(keys.next(), { value: "abc", done: false });
|
||||
assert.deepEqual(keys.next(), { value: "abc", done: false });
|
||||
assert.deepEqual(keys.next(), { value: undefined, done: true });
|
||||
|
||||
const values = searchParams.values();
|
||||
assert.deepEqual(values.next(), { value: "123", done: false });
|
||||
assert.deepEqual(values.next(), { value: "xyz", done: false });
|
||||
assert.deepEqual(values.next(), { value: undefined, done: true });
|
||||
|
||||
searchParams.set('abc', 'b');
|
||||
assert.deepEqual(searchParams.getAll('abc'), ['b']);
|
||||
|
||||
searchParams.delete('a');
|
||||
assert(!searchParams.has('a'));
|
||||
assert.equal(searchParams.get('a'), null);
|
||||
|
||||
searchParams.sort();
|
||||
}
|
||||
|
||||
{
|
||||
const searchParams = new url.URLSearchParams({
|
||||
user: 'abc',
|
||||
query: ['first', 'second']
|
||||
});
|
||||
|
||||
assert.equal(searchParams.toString(), 'user=abc&query=first%2Csecond');
|
||||
assert.deepEqual(searchParams.getAll('query'), ['first,second']);
|
||||
}
|
||||
|
||||
{
|
||||
// Using an array
|
||||
const params = new url.URLSearchParams([
|
||||
['user', 'abc'],
|
||||
['query', 'first'],
|
||||
['query', 'second'],
|
||||
// ts 2.1/2.* compatibility
|
||||
// tslint:disable-next-line no-unnecessary-type-assertion
|
||||
] as Array<[string, string]>);
|
||||
assert.equal(params.toString(), 'user=abc&query=first&query=second');
|
||||
}
|
||||
|
||||
{
|
||||
let path: string = url.fileURLToPath('file://test');
|
||||
path = url.fileURLToPath(new url.URL('file://test'));
|
||||
}
|
||||
|
||||
{
|
||||
const path: url.URL = url.pathToFileURL('file://test');
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
/// Https tests : http://nodejs.org/api/https.html ///
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
let agent: https.Agent = new https.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 10000,
|
||||
maxSockets: Infinity,
|
||||
maxFreeSockets: 256,
|
||||
maxCachedSessions: 100,
|
||||
timeout: 15000
|
||||
});
|
||||
|
||||
agent = https.globalAgent;
|
||||
|
||||
https.request({
|
||||
agent: false
|
||||
});
|
||||
https.request({
|
||||
agent
|
||||
});
|
||||
https.request({
|
||||
agent: undefined
|
||||
});
|
||||
|
||||
https.get('http://www.example.com/xyz');
|
||||
https.request('http://www.example.com/xyz');
|
||||
|
||||
https.get('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
https.request('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'));
|
||||
https.request(new url.URL('http://www.example.com/xyz'));
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
|
||||
const opts: https.RequestOptions = {
|
||||
path: '/some/path'
|
||||
};
|
||||
https.get(new url.URL('http://www.example.com'), opts);
|
||||
https.request(new url.URL('http://www.example.com'), opts);
|
||||
https.get(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.globalAgent.options.ca = [];
|
||||
|
||||
{
|
||||
function reqListener(req: http.IncomingMessage, res: http.ServerResponse): void {}
|
||||
|
||||
class MyIncomingMessage extends http.IncomingMessage {
|
||||
foo: number;
|
||||
}
|
||||
|
||||
class MyServerResponse extends http.ServerResponse {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
let server: https.Server;
|
||||
|
||||
server = new https.Server();
|
||||
server = new https.Server(reqListener);
|
||||
server = new https.Server({ IncomingMessage: MyIncomingMessage});
|
||||
|
||||
server = new https.Server({
|
||||
IncomingMessage: MyIncomingMessage,
|
||||
ServerResponse: MyServerResponse
|
||||
}, reqListener);
|
||||
|
||||
server = https.createServer();
|
||||
server = https.createServer(reqListener);
|
||||
server = https.createServer({ IncomingMessage: MyIncomingMessage });
|
||||
server = https.createServer({ ServerResponse: MyServerResponse }, reqListener);
|
||||
|
||||
const timeout: number = server.timeout;
|
||||
const listening: boolean = server.listening;
|
||||
const keepAliveTimeout: number = server.keepAliveTimeout;
|
||||
const maxHeadersCount: number | null = server.maxHeadersCount;
|
||||
const headersTimeout: number = server.headersTimeout;
|
||||
server.setTimeout().setTimeout(1000).setTimeout(() => {}).setTimeout(100, () => {});
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/// Timers tests : https://nodejs.org/api/timers.html
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const immediate = timers
|
||||
.setImmediate(() => {
|
||||
console.log('immediate');
|
||||
})
|
||||
.unref()
|
||||
.ref();
|
||||
const b: boolean = immediate.hasRef();
|
||||
timers.clearImmediate(immediate);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setInterval(() => {
|
||||
console.log('interval');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearInterval(timeout);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setTimeout(() => {
|
||||
console.log('timeout');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearTimeout(timeout);
|
||||
}
|
||||
async function testPromisify() {
|
||||
const setTimeout = util.promisify(timers.setTimeout);
|
||||
let v: void = await setTimeout(100); // tslint:disable-line no-void-expression void-return
|
||||
let s: string = await setTimeout(100, "");
|
||||
|
||||
const setImmediate = util.promisify(timers.setImmediate);
|
||||
v = await setImmediate(); // tslint:disable-line no-void-expression
|
||||
s = await setImmediate("");
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
/// Errors Tests : https://nodejs.org/api/errors.html ///
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
Error.stackTraceLimit = Infinity;
|
||||
}
|
||||
{
|
||||
const myObject = {};
|
||||
Error.captureStackTrace(myObject);
|
||||
}
|
||||
{
|
||||
const frames: NodeJS.CallSite[] = [];
|
||||
Error.prepareStackTrace!(new Error(), frames);
|
||||
}
|
||||
{
|
||||
const frame: NodeJS.CallSite = null!;
|
||||
const frameThis: any = frame.getThis();
|
||||
const typeName: string | null = frame.getTypeName();
|
||||
const func: Function | undefined = frame.getFunction();
|
||||
const funcName: string | null = frame.getFunctionName();
|
||||
const meth: string | null = frame.getMethodName();
|
||||
const fname: string | null = frame.getFileName();
|
||||
const lineno: number | null = frame.getLineNumber();
|
||||
const colno: number | null = frame.getColumnNumber();
|
||||
const evalOrigin: string | undefined = frame.getEvalOrigin();
|
||||
const isTop: boolean = frame.isToplevel();
|
||||
const isEval: boolean = frame.isEval();
|
||||
const isNative: boolean = frame.isNative();
|
||||
const isConstr: boolean = frame.isConstructor();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Console Tests : https://nodejs.org/api/console.html ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
let _c: Console = console;
|
||||
_c = console2;
|
||||
}
|
||||
{
|
||||
const writeStream = fs.createWriteStream('./index.d.ts');
|
||||
let consoleInstance: Console = new console.Console(writeStream);
|
||||
|
||||
consoleInstance = new console.Console(writeStream, writeStream);
|
||||
consoleInstance = new console.Console(writeStream, writeStream, true);
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
stderr: writeStream,
|
||||
colorMode: 'auto',
|
||||
ignoreErrors: true
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
colorMode: false
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream
|
||||
});
|
||||
}
|
||||
{
|
||||
console.assert('value');
|
||||
console.assert('value', 'message');
|
||||
console.assert('value', 'message', 'foo', 'bar');
|
||||
console.clear();
|
||||
console.count();
|
||||
console.count('label');
|
||||
console.countReset();
|
||||
console.countReset('label');
|
||||
console.debug();
|
||||
console.debug('message');
|
||||
console.debug('message', 'foo', 'bar');
|
||||
console.dir('obj');
|
||||
console.dir('obj', { depth: 1 });
|
||||
console.error();
|
||||
console.error('message');
|
||||
console.error('message', 'foo', 'bar');
|
||||
console.group();
|
||||
console.group('label');
|
||||
console.group('label1', 'label2');
|
||||
console.groupCollapsed();
|
||||
console.groupEnd();
|
||||
console.info();
|
||||
console.info('message');
|
||||
console.info('message', 'foo', 'bar');
|
||||
console.log();
|
||||
console.log('message');
|
||||
console.log('message', 'foo', 'bar');
|
||||
console.table({ foo: 'bar' });
|
||||
console.table([{ foo: 'bar' }]);
|
||||
console.table([{ foo: 'bar' }], ['foo']);
|
||||
console.time();
|
||||
console.time('label');
|
||||
console.timeEnd();
|
||||
console.timeEnd('label');
|
||||
console.timeLog();
|
||||
console.timeLog('label');
|
||||
console.timeLog('label', 'foo', 'bar');
|
||||
console.trace();
|
||||
console.trace('message');
|
||||
console.trace('message', 'foo', 'bar');
|
||||
console.warn();
|
||||
console.warn('message');
|
||||
console.warn('message', 'foo', 'bar');
|
||||
|
||||
// --- Inspector mode only ---
|
||||
console.markTimeline();
|
||||
console.markTimeline('label');
|
||||
console.profile();
|
||||
console.profile('label');
|
||||
console.profileEnd();
|
||||
console.profileEnd('label');
|
||||
console.timeStamp();
|
||||
console.timeStamp('label');
|
||||
console.timeline();
|
||||
console.timeline('label');
|
||||
console.timelineEnd();
|
||||
console.timelineEnd('label');
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
/// DNS Tests : https://nodejs.org/api/dns.html ///
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
dns.lookup("nodejs.org", (err, address, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: string = address;
|
||||
const _family: number = family;
|
||||
});
|
||||
dns.lookup("nodejs.org", 4, (err, address, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: string = address;
|
||||
const _family: number = family;
|
||||
});
|
||||
dns.lookup("nodejs.org", 6, (err, address, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: string = address;
|
||||
const _family: number = family;
|
||||
});
|
||||
dns.lookup("nodejs.org", {}, (err, address, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: string = address;
|
||||
const _family: number = family;
|
||||
});
|
||||
dns.lookup(
|
||||
"nodejs.org",
|
||||
{
|
||||
family: 4,
|
||||
hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
||||
all: false
|
||||
},
|
||||
(err, address, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: string = address;
|
||||
const _family: number = family;
|
||||
}
|
||||
);
|
||||
dns.lookup("nodejs.org", { all: true }, (err, addresses) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: dns.LookupAddress[] = addresses;
|
||||
});
|
||||
dns.lookup("nodejs.org", { all: true, verbatim: true }, (err, addresses) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _address: dns.LookupAddress[] = addresses;
|
||||
});
|
||||
|
||||
function trueOrFalse(): boolean {
|
||||
return Math.random() > 0.5 ? true : false;
|
||||
}
|
||||
dns.lookup("nodejs.org", { all: trueOrFalse() }, (err, addresses, family) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _addresses: string | dns.LookupAddress[] = addresses;
|
||||
const _family: number | undefined = family;
|
||||
});
|
||||
|
||||
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
|
||||
const _err: NodeJS.ErrnoException | null = err;
|
||||
const _hostname: string = hostname;
|
||||
const _service: string = service;
|
||||
});
|
||||
|
||||
dns.resolve("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "A", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "AAAA", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "ANY", (err, addresses) => {
|
||||
const _addresses: dns.AnyRecord[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "MX", (err, addresses) => {
|
||||
const _addresses: dns.MxRecord[] = addresses;
|
||||
});
|
||||
|
||||
dns.resolve4("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve4("nodejs.org", { ttl: true }, (err, addresses) => {
|
||||
const _addresses: dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
{
|
||||
const ttl = false;
|
||||
dns.resolve4("nodejs.org", { ttl }, (err, addresses) => {
|
||||
const _addresses: string[] | dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
}
|
||||
|
||||
dns.resolve6("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve6("nodejs.org", { ttl: true }, (err, addresses) => {
|
||||
const _addresses: dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
{
|
||||
const ttl = false;
|
||||
dns.resolve6("nodejs.org", { ttl }, (err, addresses) => {
|
||||
const _addresses: string[] | dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
}
|
||||
{
|
||||
const resolver = new dns.Resolver();
|
||||
resolver.setServers(["4.4.4.4"]);
|
||||
resolver.resolve("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
resolver.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* The following tests are the modules not mentioned in document but existed *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Constants Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
import * as constants from 'constants';
|
||||
{
|
||||
let str: string;
|
||||
let num: number;
|
||||
num = constants.SIGHUP;
|
||||
num = constants.SIGINT;
|
||||
num = constants.SIGQUIT;
|
||||
num = constants.SIGILL;
|
||||
num = constants.SIGTRAP;
|
||||
num = constants.SIGABRT;
|
||||
num = constants.SIGIOT;
|
||||
num = constants.SIGBUS;
|
||||
num = constants.SIGFPE;
|
||||
num = constants.SIGKILL;
|
||||
num = constants.SIGUSR1;
|
||||
num = constants.SIGSEGV;
|
||||
num = constants.SIGUSR2;
|
||||
num = constants.SIGPIPE;
|
||||
num = constants.SIGALRM;
|
||||
num = constants.SIGTERM;
|
||||
num = constants.SIGCHLD;
|
||||
num = constants.SIGSTKFLT;
|
||||
num = constants.SIGCONT;
|
||||
num = constants.SIGSTOP;
|
||||
num = constants.SIGTSTP;
|
||||
num = constants.SIGTTIN;
|
||||
num = constants.SIGTTOU;
|
||||
num = constants.SIGURG;
|
||||
num = constants.SIGXCPU;
|
||||
num = constants.SIGXFSZ;
|
||||
num = constants.SIGVTALRM;
|
||||
num = constants.SIGPROF;
|
||||
num = constants.SIGWINCH;
|
||||
num = constants.SIGIO;
|
||||
num = constants.SIGPOLL;
|
||||
num = constants.SIGPWR;
|
||||
num = constants.SIGSYS;
|
||||
num = constants.SIGUNUSED;
|
||||
num = constants.O_RDONLY;
|
||||
num = constants.O_WRONLY;
|
||||
num = constants.O_RDWR;
|
||||
num = constants.S_IFMT;
|
||||
num = constants.S_IFREG;
|
||||
num = constants.S_IFDIR;
|
||||
num = constants.S_IFCHR;
|
||||
num = constants.S_IFBLK;
|
||||
num = constants.S_IFIFO;
|
||||
num = constants.S_IFLNK;
|
||||
num = constants.S_IFSOCK;
|
||||
num = constants.O_CREAT;
|
||||
num = constants.O_EXCL;
|
||||
num = constants.O_NOCTTY;
|
||||
num = constants.O_TRUNC;
|
||||
num = constants.O_APPEND;
|
||||
num = constants.O_DIRECTORY;
|
||||
num = constants.O_NOATIME;
|
||||
num = constants.O_NOFOLLOW;
|
||||
num = constants.O_SYNC;
|
||||
num = constants.O_DSYNC;
|
||||
num = constants.O_DIRECT;
|
||||
num = constants.O_NONBLOCK;
|
||||
num = constants.S_IRWXU;
|
||||
num = constants.S_IRUSR;
|
||||
num = constants.S_IWUSR;
|
||||
num = constants.S_IXUSR;
|
||||
num = constants.S_IRWXG;
|
||||
num = constants.S_IRGRP;
|
||||
num = constants.S_IWGRP;
|
||||
num = constants.S_IXGRP;
|
||||
num = constants.S_IRWXO;
|
||||
num = constants.S_IROTH;
|
||||
num = constants.S_IWOTH;
|
||||
num = constants.S_IXOTH;
|
||||
num = constants.F_OK;
|
||||
num = constants.R_OK;
|
||||
num = constants.W_OK;
|
||||
num = constants.X_OK;
|
||||
num = constants.SSL_OP_ALL;
|
||||
num = constants.SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION;
|
||||
num = constants.SSL_OP_CIPHER_SERVER_PREFERENCE;
|
||||
num = constants.SSL_OP_CISCO_ANYCONNECT;
|
||||
num = constants.SSL_OP_COOKIE_EXCHANGE;
|
||||
num = constants.SSL_OP_CRYPTOPRO_TLSEXT_BUG;
|
||||
num = constants.SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
|
||||
num = constants.SSL_OP_EPHEMERAL_RSA;
|
||||
num = constants.SSL_OP_LEGACY_SERVER_CONNECT;
|
||||
num = constants.SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER;
|
||||
num = constants.SSL_OP_MICROSOFT_SESS_ID_BUG;
|
||||
num = constants.SSL_OP_MSIE_SSLV2_RSA_PADDING;
|
||||
num = constants.SSL_OP_NETSCAPE_CA_DN_BUG;
|
||||
num = constants.SSL_OP_NETSCAPE_CHALLENGE_BUG;
|
||||
num = constants.SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG;
|
||||
num = constants.SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG;
|
||||
num = constants.SSL_OP_NO_COMPRESSION;
|
||||
num = constants.SSL_OP_NO_QUERY_MTU;
|
||||
num = constants.SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION;
|
||||
num = constants.SSL_OP_NO_SSLv2;
|
||||
num = constants.SSL_OP_NO_SSLv3;
|
||||
num = constants.SSL_OP_NO_TICKET;
|
||||
num = constants.SSL_OP_NO_TLSv1;
|
||||
num = constants.SSL_OP_NO_TLSv1_1;
|
||||
num = constants.SSL_OP_NO_TLSv1_2;
|
||||
num = constants.SSL_OP_PKCS1_CHECK_1;
|
||||
num = constants.SSL_OP_PKCS1_CHECK_2;
|
||||
num = constants.SSL_OP_SINGLE_DH_USE;
|
||||
num = constants.SSL_OP_SINGLE_ECDH_USE;
|
||||
num = constants.SSL_OP_SSLEAY_080_CLIENT_DH_BUG;
|
||||
num = constants.SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG;
|
||||
num = constants.SSL_OP_TLS_BLOCK_PADDING_BUG;
|
||||
num = constants.SSL_OP_TLS_D5_BUG;
|
||||
num = constants.SSL_OP_TLS_ROLLBACK_BUG;
|
||||
num = constants.ENGINE_METHOD_RSA;
|
||||
num = constants.ENGINE_METHOD_DSA;
|
||||
num = constants.ENGINE_METHOD_DH;
|
||||
num = constants.ENGINE_METHOD_RAND;
|
||||
num = constants.ENGINE_METHOD_ECDH;
|
||||
num = constants.ENGINE_METHOD_ECDSA;
|
||||
num = constants.ENGINE_METHOD_CIPHERS;
|
||||
num = constants.ENGINE_METHOD_DIGESTS;
|
||||
num = constants.ENGINE_METHOD_STORE;
|
||||
num = constants.ENGINE_METHOD_PKEY_METHS;
|
||||
num = constants.ENGINE_METHOD_PKEY_ASN1_METHS;
|
||||
num = constants.ENGINE_METHOD_ALL;
|
||||
num = constants.ENGINE_METHOD_NONE;
|
||||
num = constants.DH_CHECK_P_NOT_SAFE_PRIME;
|
||||
num = constants.DH_CHECK_P_NOT_PRIME;
|
||||
num = constants.DH_UNABLE_TO_CHECK_GENERATOR;
|
||||
num = constants.DH_NOT_SUITABLE_GENERATOR;
|
||||
num = constants.ALPN_ENABLED;
|
||||
num = constants.RSA_PKCS1_PADDING;
|
||||
num = constants.RSA_SSLV23_PADDING;
|
||||
num = constants.RSA_NO_PADDING;
|
||||
num = constants.RSA_PKCS1_OAEP_PADDING;
|
||||
num = constants.RSA_X931_PADDING;
|
||||
num = constants.RSA_PKCS1_PSS_PADDING;
|
||||
num = constants.POINT_CONVERSION_COMPRESSED;
|
||||
num = constants.POINT_CONVERSION_UNCOMPRESSED;
|
||||
num = constants.POINT_CONVERSION_HYBRID;
|
||||
str = constants.defaultCoreCipherList;
|
||||
str = constants.defaultCipherList;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Inspector Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const b: inspector.Console.ConsoleMessage = {source: 'test', text: 'test', level: 'error' };
|
||||
inspector.open();
|
||||
inspector.open(0);
|
||||
inspector.open(0, 'localhost');
|
||||
inspector.open(0, 'localhost', true);
|
||||
inspector.close();
|
||||
const inspectorUrl: string | undefined = inspector.url();
|
||||
|
||||
const session = new inspector.Session();
|
||||
session.connect();
|
||||
session.disconnect();
|
||||
|
||||
// Unknown post method
|
||||
session.post('A.b', { key: 'value' }, (err, params) => {});
|
||||
// TODO: parameters are implicitly 'any' and need type annotation
|
||||
session.post('A.b', (err: Error | null, params?: {}) => {});
|
||||
session.post('A.b');
|
||||
// Known post method
|
||||
const parameter: inspector.Runtime.EvaluateParameterType = { expression: '2 + 2' };
|
||||
session.post('Runtime.evaluate', parameter,
|
||||
(err: Error | null, params: inspector.Runtime.EvaluateReturnType) => {});
|
||||
session.post('Runtime.evaluate', (err: Error, params: inspector.Runtime.EvaluateReturnType) => {
|
||||
const exceptionDetails: inspector.Runtime.ExceptionDetails = params.exceptionDetails!;
|
||||
const resultClassName: string = params.result.className!;
|
||||
});
|
||||
session.post('Runtime.evaluate');
|
||||
|
||||
// General event
|
||||
session.on('inspectorNotification', message => {
|
||||
message; // $ExpectType InspectorNotification<{}>
|
||||
});
|
||||
// Known events
|
||||
session.on('Debugger.paused', (message: inspector.InspectorNotification<inspector.Debugger.PausedEventDataType>) => {
|
||||
const method: string = message.method;
|
||||
const pauseReason: string = message.params.reason;
|
||||
});
|
||||
session.on('Debugger.resumed', () => {});
|
||||
// Node Inspector events
|
||||
session.on('NodeTracing.dataCollected', (message: inspector.InspectorNotification<inspector.NodeTracing.DataCollectedEventDataType>) => {
|
||||
const value: Array<{}> = message.params.value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Trace Events Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const enabledCategories: string | undefined = trace_events.getEnabledCategories();
|
||||
const tracing: trace_events.Tracing = trace_events.createTracing({ categories: ['node', 'v8'] });
|
||||
const categories: string = tracing.categories;
|
||||
const enabled: boolean = tracing.enabled;
|
||||
tracing.enable();
|
||||
tracing.disable();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// module tests : http://nodejs.org/api/modules.html
|
||||
////////////////////////////////////////////////////
|
||||
import moduleModule = require('module');
|
||||
|
||||
{
|
||||
require.extensions[".ts"] = () => "";
|
||||
|
||||
Module.runMain();
|
||||
const s: string = Module.wrap("some code");
|
||||
|
||||
const m1: Module = new Module("moduleId");
|
||||
const m2: Module = new Module.Module("moduleId");
|
||||
const b: string[] = Module.builtinModules;
|
||||
let paths: string[] = module.paths;
|
||||
const path: string = module.path;
|
||||
paths = m1.paths;
|
||||
|
||||
const customRequire1 = moduleModule.createRequireFromPath('./test');
|
||||
const customRequire2 = moduleModule.createRequire('./test');
|
||||
|
||||
customRequire1('test');
|
||||
customRequire2('test');
|
||||
|
||||
const resolved1: string = customRequire1.resolve('test');
|
||||
const resolved2: string = customRequire2.resolve('test');
|
||||
|
||||
const paths1: string[] | null = customRequire1.resolve.paths('test');
|
||||
const paths2: string[] | null = customRequire2.resolve.paths('test');
|
||||
|
||||
const cachedModule1: Module = customRequire1.cache['/path/to/module.js'];
|
||||
const cachedModule2: Module = customRequire2.cache['/path/to/module.js'];
|
||||
|
||||
const main1: Module | undefined = customRequire1.main;
|
||||
const main2: Module | undefined = customRequire2.main;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
/// stream tests : https://nodejs.org/api/stream.html ///
|
||||
/////////////////////////////////////////////////////////
|
||||
import stream = require('stream');
|
||||
import tty = require('tty');
|
||||
|
||||
{
|
||||
const writeStream = fs.createWriteStream('./index.d.ts');
|
||||
const _wom = writeStream.writableObjectMode; // $ExpectType boolean
|
||||
|
||||
const readStream = fs.createReadStream('./index.d.ts');
|
||||
const _rom = readStream.readableObjectMode; // $ExpectType boolean
|
||||
|
||||
const x: stream.Readable = process.stdin;
|
||||
const stdin: tty.ReadStream = process.stdin;
|
||||
const stdout: tty.WriteStream = process.stdout;
|
||||
const stderr: tty.WriteStream = process.stderr;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
/// dgram tests : https://nodejs.org/api/dgram.html ///
|
||||
/////////////////////////////////////////////////////////
|
||||
{
|
||||
let sock: dgram.Socket = dgram.createSocket("udp4");
|
||||
sock = dgram.createSocket({ type: "udp4" });
|
||||
sock = dgram.createSocket({
|
||||
type: "udp4",
|
||||
reuseAddr: true,
|
||||
ipv6Only: false,
|
||||
recvBufferSize: 4096,
|
||||
sendBufferSize: 4096,
|
||||
lookup: dns.lookup,
|
||||
});
|
||||
sock = dgram.createSocket("udp6", (msg, rinfo) => {
|
||||
msg; // $ExpectType Buffer
|
||||
rinfo; // $ExpectType RemoteInfo
|
||||
});
|
||||
sock.addMembership("233.252.0.0");
|
||||
sock.addMembership("233.252.0.0", "192.0.2.1");
|
||||
sock.address().address; // $ExpectType string
|
||||
sock.address().family; // $ExpectType string
|
||||
sock.address().port; // $ExpectType number
|
||||
sock.bind();
|
||||
sock.bind(() => undefined);
|
||||
sock.bind(8000);
|
||||
sock.bind(8000, () => undefined);
|
||||
sock.bind(8000, "192.0.2.1");
|
||||
sock.bind(8000, "192.0.2.1", () => undefined);
|
||||
sock.bind({}, () => undefined);
|
||||
sock.bind({ port: 8000, address: "192.0.2.1", exclusive: true });
|
||||
sock.bind({ fd: 7, exclusive: true });
|
||||
sock.close();
|
||||
sock.close(() => undefined);
|
||||
sock.connect(8000);
|
||||
sock.connect(8000, "192.0.2.1");
|
||||
sock.connect(8000, () => undefined);
|
||||
sock.connect(8000, "192.0.2.1", () => undefined);
|
||||
sock.disconnect();
|
||||
sock.dropMembership("233.252.0.0");
|
||||
sock.dropMembership("233.252.0.0", "192.0.2.1");
|
||||
sock.getRecvBufferSize(); // $ExpectType number
|
||||
sock.getSendBufferSize(); // $ExpectType number
|
||||
sock = sock.ref();
|
||||
sock.remoteAddress().address; // $ExpectType string
|
||||
sock.remoteAddress().family; // $ExpectType string
|
||||
sock.remoteAddress().port; // $ExpectType number
|
||||
sock.send("datagram");
|
||||
sock.send(new Uint8Array(256), 8000, (err) => {
|
||||
err; // $ExpectType Error | null
|
||||
});
|
||||
sock.send(Buffer.alloc(256), 8000, "192.0.2.1");
|
||||
sock.send(new Uint8Array(256), 128, 64);
|
||||
sock.send("datagram", 128, 64, (err) => undefined);
|
||||
sock.send(new Uint8Array(256), 128, 64, 8000);
|
||||
sock.send(new Uint8Array(256), 128, 64, 8000, (err) => undefined);
|
||||
sock.send(Buffer.alloc(256), 128, 64, 8000, "192.0.2.1");
|
||||
sock.send("datagram", 128, 64, 8000, "192.0.2.1", (err) => undefined);
|
||||
sock.setBroadcast(true);
|
||||
sock.setMulticastInterface("192.0.2.1");
|
||||
sock.setMulticastLoopback(false);
|
||||
sock.setMulticastTTL(128);
|
||||
sock.setRecvBufferSize(4096);
|
||||
sock.setSendBufferSize(4096);
|
||||
sock.setTTL(128);
|
||||
sock = sock.unref();
|
||||
|
||||
sock.on("close", () => undefined);
|
||||
sock.on("connect", () => undefined);
|
||||
sock.on("error", (exception) => {
|
||||
exception; // $ExpectType Error
|
||||
});
|
||||
sock.on("listening", () => undefined);
|
||||
sock.on("message", (msg, rinfo) => {
|
||||
msg; // $ExpectType Buffer
|
||||
rinfo.address; // $ExpectType string
|
||||
rinfo.family; // $ExpectType "IPv4" | "IPv6"
|
||||
rinfo.port; // $ExpectType number
|
||||
rinfo.size; // $ExpectType number
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Node.js ESNEXT Support
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const s = 'foo';
|
||||
const s1: string = s.trimLeft();
|
||||
const s2: string = s.trimRight();
|
||||
const s3: string = s.trimStart();
|
||||
const s4: string = s.trimEnd();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
/// Global Tests : https://nodejs.org/api/global.html ///
|
||||
@ -39,10 +911,10 @@ import { BigIntStats, statSync, Stats } from 'fs';
|
||||
// Util Tests
|
||||
{
|
||||
const value: BigInt64Array | BigUint64Array | number = [] as any;
|
||||
if (types.isBigInt64Array(value)) {
|
||||
if (util.types.isBigInt64Array(value)) {
|
||||
// $ExpectType BigInt64Array
|
||||
const b = value;
|
||||
} else if (types.isBigUint64Array(value)) {
|
||||
} else if (util.types.isBigUint64Array(value)) {
|
||||
// $ExpectType BigUint64Array
|
||||
const b = value;
|
||||
} else {
|
||||
@ -50,14 +922,14 @@ import { BigIntStats, statSync, Stats } from 'fs';
|
||||
const b = value;
|
||||
}
|
||||
|
||||
const arg1UnknownError: (arg: string) => Promise<number> = promisify((arg: string, cb: (err: unknown, result: number) => void): void => { });
|
||||
const arg1AnyError: (arg: string) => Promise<number> = promisify((arg: string, cb: (err: any, result: number) => void): void => { });
|
||||
const arg1UnknownError: (arg: string) => Promise<number> = util.promisify((arg: string, cb: (err: unknown, result: number) => void): void => { });
|
||||
const arg1AnyError: (arg: string) => Promise<number> = util.promisify((arg: string, cb: (err: any, result: number) => void): void => { });
|
||||
}
|
||||
|
||||
// FS Tests
|
||||
{
|
||||
const bigStats: BigIntStats = statSync('.', { bigint: true });
|
||||
const anyStats: Stats | BigIntStats = statSync('.', { bigint: Math.random() > 0.5 });
|
||||
const bigStats: fs.BigIntStats = fs.statSync('.', { bigint: true });
|
||||
const anyStats: fs.Stats | fs.BigIntStats = fs.statSync('.', { bigint: Math.random() > 0.5 });
|
||||
}
|
||||
|
||||
// Global Tests
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-bad-reference": false
|
||||
"ban-types": false,
|
||||
"no-bad-reference": false,
|
||||
"no-empty-interface": false,
|
||||
"no-single-declare-module": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
|
||||
2
types/node/v12/ts3.6/index.d.ts
vendored
2
types/node/v12/ts3.6/index.d.ts
vendored
@ -5,4 +5,4 @@
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/assert.d.ts" />
|
||||
/// <reference path="../ts3.3/assert.d.ts" />
|
||||
|
||||
178
types/node/v12/util.d.ts
vendored
178
types/node/v12/util.d.ts
vendored
@ -1,15 +1,187 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="ts3.1/util.d.ts" />
|
||||
|
||||
declare module "util" {
|
||||
interface InspectOptions extends NodeJS.InspectOptions { }
|
||||
function format(format: any, ...param: any[]): string;
|
||||
function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
|
||||
/** @deprecated since v0.11.3 - use a third party module instead. */
|
||||
function log(string: string): void;
|
||||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
function inspect(object: any, options: InspectOptions): string;
|
||||
namespace inspect {
|
||||
const custom: unique symbol;
|
||||
let colors: {
|
||||
[color: string]: [number, number] | undefined
|
||||
};
|
||||
let styles: {
|
||||
[style: string]: string | undefined
|
||||
};
|
||||
let defaultOptions: InspectOptions;
|
||||
/**
|
||||
* Allows changing inspect settings from the repl.
|
||||
*/
|
||||
let replDefaults: InspectOptions;
|
||||
}
|
||||
/** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
|
||||
function isArray(object: any): object is any[];
|
||||
/** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
|
||||
function isDate(object: any): object is Date;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
|
||||
function isError(object: any): object is Error;
|
||||
function inherits(constructor: any, superConstructor: any): void;
|
||||
function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
|
||||
function isBoolean(object: any): object is boolean;
|
||||
/** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
|
||||
function isBuffer(object: any): object is Buffer;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
|
||||
function isFunction(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `value === null` instead. */
|
||||
function isNull(object: any): object is null;
|
||||
/** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
|
||||
function isNullOrUndefined(object: any): object is null | undefined;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
|
||||
function isNumber(object: any): object is number;
|
||||
/** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
|
||||
function isObject(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
|
||||
function isPrimitive(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
|
||||
function isString(object: any): object is string;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
|
||||
function isSymbol(object: any): object is symbol;
|
||||
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
|
||||
function isUndefined(object: any): object is undefined;
|
||||
function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
|
||||
function isDeepStrictEqual(val1: any, val2: any): boolean;
|
||||
|
||||
interface CustomPromisify<TCustom extends Function> extends Function {
|
||||
__promisify__: TCustom;
|
||||
}
|
||||
|
||||
function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
|
||||
function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
||||
function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
|
||||
function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
||||
function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
||||
function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
||||
function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
||||
function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
||||
function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
function promisify(fn: Function): Function;
|
||||
namespace promisify {
|
||||
const custom: unique symbol;
|
||||
}
|
||||
|
||||
namespace types {
|
||||
function isAnyArrayBuffer(object: any): boolean;
|
||||
function isArgumentsObject(object: any): object is IArguments;
|
||||
function isArrayBuffer(object: any): object is ArrayBuffer;
|
||||
function isArrayBufferView(object: any): object is ArrayBufferView;
|
||||
function isAsyncFunction(object: any): boolean;
|
||||
function isBigInt64Array(value: any): value is BigInt64Array;
|
||||
function isBigUint64Array(value: any): value is BigUint64Array;
|
||||
function isBooleanObject(object: any): object is Boolean;
|
||||
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
|
||||
function isDataView(object: any): object is DataView;
|
||||
function isDate(object: any): object is Date;
|
||||
function isExternal(object: any): boolean;
|
||||
function isFloat32Array(object: any): object is Float32Array;
|
||||
function isFloat64Array(object: any): object is Float64Array;
|
||||
function isGeneratorFunction(object: any): boolean;
|
||||
function isGeneratorObject(object: any): boolean;
|
||||
function isInt8Array(object: any): object is Int8Array;
|
||||
function isInt16Array(object: any): object is Int16Array;
|
||||
function isInt32Array(object: any): object is Int32Array;
|
||||
function isMap(object: any): boolean;
|
||||
function isMapIterator(object: any): boolean;
|
||||
function isModuleNamespaceObject(value: any): boolean;
|
||||
function isNativeError(object: any): object is Error;
|
||||
function isNumberObject(object: any): object is Number;
|
||||
function isPromise(object: any): boolean;
|
||||
function isProxy(object: any): boolean;
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
function isSet(object: any): boolean;
|
||||
function isSetIterator(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): boolean;
|
||||
function isStringObject(object: any): boolean;
|
||||
function isSymbolObject(object: any): boolean;
|
||||
function isTypedArray(object: any): object is NodeJS.TypedArray;
|
||||
function isUint8Array(object: any): object is Uint8Array;
|
||||
function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
||||
function isUint16Array(object: any): object is Uint16Array;
|
||||
function isUint32Array(object: any): object is Uint32Array;
|
||||
function isWeakMap(object: any): boolean;
|
||||
function isWeakSet(object: any): boolean;
|
||||
function isWebAssemblyCompiledModule(object: any): boolean;
|
||||
}
|
||||
|
||||
class TextDecoder {
|
||||
readonly encoding: string;
|
||||
readonly fatal: boolean;
|
||||
readonly ignoreBOM: boolean;
|
||||
constructor(
|
||||
encoding?: string,
|
||||
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
||||
);
|
||||
decode(
|
||||
input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
||||
options?: { stream?: boolean }
|
||||
): string;
|
||||
}
|
||||
|
||||
interface EncodeIntoResult {
|
||||
/**
|
||||
* The read Unicode code units of input.
|
||||
*/
|
||||
|
||||
read: number;
|
||||
/**
|
||||
* The written UTF-8 bytes of output.
|
||||
*/
|
||||
written: number;
|
||||
}
|
||||
|
||||
class TextEncoder {
|
||||
readonly encoding: string;
|
||||
encode(input?: string): Uint8Array;
|
||||
encodeInto(input: string, output: Uint8Array): EncodeIntoResult;
|
||||
}
|
||||
}
|
||||
|
||||
2663
types/node/v13/fs.d.ts
vendored
2663
types/node/v13/fs.d.ts
vendored
File diff suppressed because it is too large
Load Diff
1130
types/node/v13/globals.d.ts
vendored
1130
types/node/v13/globals.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -2,11 +2,6 @@
|
||||
"private": true,
|
||||
"types": "index",
|
||||
"typesVersions": {
|
||||
"<=3.1": {
|
||||
"*": [
|
||||
"ts3.1/*"
|
||||
]
|
||||
},
|
||||
"<=3.4": {
|
||||
"*": [
|
||||
"ts3.4/*"
|
||||
|
||||
40
types/node/v13/ts3.1/base.d.ts
vendored
40
types/node/v13/ts3.1/base.d.ts
vendored
@ -1,40 +0,0 @@
|
||||
// base definitions for all NodeJS modules that are not specific to any version of TypeScript
|
||||
/// <reference path="globals.d.ts" />
|
||||
/// <reference path="../async_hooks.d.ts" />
|
||||
/// <reference path="../buffer.d.ts" />
|
||||
/// <reference path="../child_process.d.ts" />
|
||||
/// <reference path="../cluster.d.ts" />
|
||||
/// <reference path="../console.d.ts" />
|
||||
/// <reference path="../constants.d.ts" />
|
||||
/// <reference path="../crypto.d.ts" />
|
||||
/// <reference path="../dgram.d.ts" />
|
||||
/// <reference path="../dns.d.ts" />
|
||||
/// <reference path="../domain.d.ts" />
|
||||
/// <reference path="../events.d.ts" />
|
||||
/// <reference path="fs.d.ts" />
|
||||
/// <reference path="../http.d.ts" />
|
||||
/// <reference path="../http2.d.ts" />
|
||||
/// <reference path="../https.d.ts" />
|
||||
/// <reference path="../inspector.d.ts" />
|
||||
/// <reference path="../module.d.ts" />
|
||||
/// <reference path="../net.d.ts" />
|
||||
/// <reference path="../os.d.ts" />
|
||||
/// <reference path="../path.d.ts" />
|
||||
/// <reference path="../perf_hooks.d.ts" />
|
||||
/// <reference path="../process.d.ts" />
|
||||
/// <reference path="../punycode.d.ts" />
|
||||
/// <reference path="../querystring.d.ts" />
|
||||
/// <reference path="../readline.d.ts" />
|
||||
/// <reference path="../repl.d.ts" />
|
||||
/// <reference path="../stream.d.ts" />
|
||||
/// <reference path="../string_decoder.d.ts" />
|
||||
/// <reference path="../timers.d.ts" />
|
||||
/// <reference path="../tls.d.ts" />
|
||||
/// <reference path="../trace_events.d.ts" />
|
||||
/// <reference path="../tty.d.ts" />
|
||||
/// <reference path="../url.d.ts" />
|
||||
/// <reference path="util.d.ts" />
|
||||
/// <reference path="../v8.d.ts" />
|
||||
/// <reference path="../vm.d.ts" />
|
||||
/// <reference path="../worker_threads.d.ts" />
|
||||
/// <reference path="../zlib.d.ts" />
|
||||
2644
types/node/v13/ts3.1/fs.d.ts
vendored
2644
types/node/v13/ts3.1/fs.d.ts
vendored
File diff suppressed because it is too large
Load Diff
1125
types/node/v13/ts3.1/globals.d.ts
vendored
1125
types/node/v13/ts3.1/globals.d.ts
vendored
File diff suppressed because it is too large
Load Diff
44
types/node/v13/ts3.1/index.d.ts
vendored
44
types/node/v13/ts3.1/index.d.ts
vendored
@ -1,44 +0,0 @@
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.5.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.8
|
||||
// - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5
|
||||
|
||||
// NOTE: Augmentations for TypeScript 3.5 and later should use individual files for overrides
|
||||
// within the respective ~/ts3.5 (or later) folder. However, this is disallowed for versions
|
||||
// prior to TypeScript 3.5, so the older definitions will be found here.
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// We can't include globals.global.d.ts in globals.d.ts, as it'll cause duplication errors in TypeScript 3.5+
|
||||
/// <reference path="globals.global.d.ts" />
|
||||
|
||||
// We can't include assert.d.ts in base.d.ts, as it'll cause duplication errors in TypeScript 3.7+
|
||||
/// <reference path="assert.d.ts" />
|
||||
|
||||
// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
|
||||
// Empty interfaces are used here which merge fine with the real declarations in the lib XXX files
|
||||
// just to ensure the names are known and node typings can be used without importing these libs.
|
||||
// if someone really needs these types the libs need to be added via --lib or in tsconfig.json
|
||||
interface AsyncIterable<T> { }
|
||||
interface IterableIterator<T> { }
|
||||
interface AsyncIterableIterator<T> {}
|
||||
interface SymbolConstructor {
|
||||
readonly asyncIterator: symbol;
|
||||
}
|
||||
declare var Symbol: SymbolConstructor;
|
||||
// even this is just a forward declaration some properties are added otherwise
|
||||
// it would be allowed to pass anything to e.g. Buffer.from()
|
||||
interface SharedArrayBuffer {
|
||||
readonly byteLength: number;
|
||||
slice(begin?: number, end?: number): SharedArrayBuffer;
|
||||
}
|
||||
|
||||
declare module "util" {
|
||||
namespace types {
|
||||
function isBigInt64Array(value: any): boolean;
|
||||
function isBigUint64Array(value: any): boolean;
|
||||
}
|
||||
}
|
||||
@ -1,349 +0,0 @@
|
||||
import * as fs from "fs";
|
||||
import * as url from "url";
|
||||
import * as util from "util";
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
import * as console2 from "console";
|
||||
import * as timers from "timers";
|
||||
import * as inspector from "inspector";
|
||||
import * as trace_events from "trace_events";
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
/// Https tests : http://nodejs.org/api/https.html ///
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
let agent: https.Agent = new https.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 10000,
|
||||
maxSockets: Infinity,
|
||||
maxFreeSockets: 256,
|
||||
maxCachedSessions: 100,
|
||||
timeout: 15000
|
||||
});
|
||||
|
||||
agent = https.globalAgent;
|
||||
|
||||
https.request({
|
||||
agent: false
|
||||
});
|
||||
https.request({
|
||||
agent
|
||||
});
|
||||
https.request({
|
||||
agent: undefined
|
||||
});
|
||||
|
||||
https.get('http://www.example.com/xyz');
|
||||
https.request('http://www.example.com/xyz');
|
||||
|
||||
https.get('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
https.request('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'));
|
||||
https.request(new url.URL('http://www.example.com/xyz'));
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
|
||||
const opts: https.RequestOptions = {
|
||||
path: '/some/path'
|
||||
};
|
||||
https.get(new url.URL('http://www.example.com'), opts);
|
||||
https.request(new url.URL('http://www.example.com'), opts);
|
||||
https.get(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.globalAgent.options.ca = [];
|
||||
|
||||
{
|
||||
function reqListener(req: http.IncomingMessage, res: http.ServerResponse): void {}
|
||||
|
||||
class MyIncomingMessage extends http.IncomingMessage {
|
||||
foo: number;
|
||||
}
|
||||
|
||||
class MyServerResponse extends http.ServerResponse {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
let server: https.Server;
|
||||
|
||||
server = new https.Server();
|
||||
server = new https.Server(reqListener);
|
||||
server = new https.Server({ IncomingMessage: MyIncomingMessage});
|
||||
|
||||
server = new https.Server({
|
||||
IncomingMessage: MyIncomingMessage,
|
||||
ServerResponse: MyServerResponse
|
||||
}, reqListener);
|
||||
|
||||
server = https.createServer();
|
||||
server = https.createServer(reqListener);
|
||||
server = https.createServer({ IncomingMessage: MyIncomingMessage });
|
||||
server = https.createServer({ ServerResponse: MyServerResponse }, reqListener);
|
||||
|
||||
const timeout: number = server.timeout;
|
||||
const listening: boolean = server.listening;
|
||||
const keepAliveTimeout: number = server.keepAliveTimeout;
|
||||
const maxHeadersCount: number | null = server.maxHeadersCount;
|
||||
const headersTimeout: number = server.headersTimeout;
|
||||
server.setTimeout().setTimeout(1000).setTimeout(() => {}).setTimeout(100, () => {});
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/// Timers tests : https://nodejs.org/api/timers.html
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const immediate = timers
|
||||
.setImmediate(() => {
|
||||
console.log('immediate');
|
||||
})
|
||||
.unref()
|
||||
.ref();
|
||||
const b: boolean = immediate.hasRef();
|
||||
timers.clearImmediate(immediate);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setInterval(() => {
|
||||
console.log('interval');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearInterval(timeout);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setTimeout(() => {
|
||||
console.log('timeout');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearTimeout(timeout);
|
||||
}
|
||||
async function testPromisify(doSomething: {
|
||||
(foo: any, onSuccessCallback: (result: string) => void, onErrorCallback: (reason: any) => void): void;
|
||||
[util.promisify.custom](foo: any): Promise<string>;
|
||||
}) {
|
||||
const setTimeout = util.promisify(timers.setTimeout);
|
||||
let v: void = await setTimeout(100); // tslint:disable-line no-void-expression void-return
|
||||
let s: string = await setTimeout(100, "");
|
||||
|
||||
const setImmediate = util.promisify(timers.setImmediate);
|
||||
v = await setImmediate(); // tslint:disable-line no-void-expression
|
||||
s = await setImmediate("");
|
||||
|
||||
// $ExpectType (foo: any) => Promise<string>
|
||||
const doSomethingPromise = util.promisify(doSomething);
|
||||
|
||||
// $ExpectType string
|
||||
s = await doSomethingPromise('foo');
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
/// Errors Tests : https://nodejs.org/api/errors.html ///
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
Error.stackTraceLimit = Infinity;
|
||||
}
|
||||
{
|
||||
const myObject = {};
|
||||
Error.captureStackTrace(myObject);
|
||||
}
|
||||
{
|
||||
const frames: NodeJS.CallSite[] = [];
|
||||
Error.prepareStackTrace!(new Error(), frames);
|
||||
}
|
||||
{
|
||||
const frame: NodeJS.CallSite = null!;
|
||||
const frameThis: any = frame.getThis();
|
||||
const typeName: string | null = frame.getTypeName();
|
||||
const func: Function | undefined = frame.getFunction();
|
||||
const funcName: string | null = frame.getFunctionName();
|
||||
const meth: string | null = frame.getMethodName();
|
||||
const fname: string | null = frame.getFileName();
|
||||
const lineno: number | null = frame.getLineNumber();
|
||||
const colno: number | null = frame.getColumnNumber();
|
||||
const evalOrigin: string | undefined = frame.getEvalOrigin();
|
||||
const isTop: boolean = frame.isToplevel();
|
||||
const isEval: boolean = frame.isEval();
|
||||
const isNative: boolean = frame.isNative();
|
||||
const isConstr: boolean = frame.isConstructor();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Console Tests : https://nodejs.org/api/console.html ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
let _c: Console = console;
|
||||
_c = console2;
|
||||
}
|
||||
{
|
||||
const writeStream = fs.createWriteStream('./index.d.ts');
|
||||
let consoleInstance: Console = new console.Console(writeStream);
|
||||
|
||||
consoleInstance = new console.Console(writeStream, writeStream);
|
||||
consoleInstance = new console.Console(writeStream, writeStream, true);
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
stderr: writeStream,
|
||||
colorMode: 'auto',
|
||||
ignoreErrors: true
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
colorMode: false
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream
|
||||
});
|
||||
}
|
||||
{
|
||||
console.assert('value');
|
||||
console.assert('value', 'message');
|
||||
console.assert('value', 'message', 'foo', 'bar');
|
||||
console.clear();
|
||||
console.count();
|
||||
console.count('label');
|
||||
console.countReset();
|
||||
console.countReset('label');
|
||||
console.debug();
|
||||
console.debug('message');
|
||||
console.debug('message', 'foo', 'bar');
|
||||
console.dir('obj');
|
||||
console.dir('obj', { depth: 1 });
|
||||
console.error();
|
||||
console.error('message');
|
||||
console.error('message', 'foo', 'bar');
|
||||
console.group();
|
||||
console.group('label');
|
||||
console.group('label1', 'label2');
|
||||
console.groupCollapsed();
|
||||
console.groupEnd();
|
||||
console.info();
|
||||
console.info('message');
|
||||
console.info('message', 'foo', 'bar');
|
||||
console.log();
|
||||
console.log('message');
|
||||
console.log('message', 'foo', 'bar');
|
||||
console.table({ foo: 'bar' });
|
||||
console.table([{ foo: 'bar' }]);
|
||||
console.table([{ foo: 'bar' }], ['foo']);
|
||||
console.time();
|
||||
console.time('label');
|
||||
console.timeEnd();
|
||||
console.timeEnd('label');
|
||||
console.timeLog();
|
||||
console.timeLog('label');
|
||||
console.timeLog('label', 'foo', 'bar');
|
||||
console.trace();
|
||||
console.trace('message');
|
||||
console.trace('message', 'foo', 'bar');
|
||||
console.warn();
|
||||
console.warn('message');
|
||||
console.warn('message', 'foo', 'bar');
|
||||
|
||||
// --- Inspector mode only ---
|
||||
console.profile();
|
||||
console.profile('label');
|
||||
console.profileEnd();
|
||||
console.profileEnd('label');
|
||||
console.timeStamp();
|
||||
console.timeStamp('label');
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* The following tests are the modules not mentioned in document but existed *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Inspector Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const b: inspector.Console.ConsoleMessage = {source: 'test', text: 'test', level: 'error' };
|
||||
inspector.open();
|
||||
inspector.open(0);
|
||||
inspector.open(0, 'localhost');
|
||||
inspector.open(0, 'localhost', true);
|
||||
inspector.close();
|
||||
const inspectorUrl: string | undefined = inspector.url();
|
||||
|
||||
const session = new inspector.Session();
|
||||
session.connect();
|
||||
session.disconnect();
|
||||
|
||||
// Unknown post method
|
||||
session.post('A.b', { key: 'value' }, (err, params) => {});
|
||||
// TODO: parameters are implicitly 'any' and need type annotation
|
||||
session.post('A.b', (err: Error | null, params?: {}) => {});
|
||||
session.post('A.b');
|
||||
// Known post method
|
||||
const parameter: inspector.Runtime.EvaluateParameterType = { expression: '2 + 2' };
|
||||
session.post('Runtime.evaluate', parameter,
|
||||
(err: Error | null, params: inspector.Runtime.EvaluateReturnType) => {});
|
||||
session.post('Runtime.evaluate', (err: Error, params: inspector.Runtime.EvaluateReturnType) => {
|
||||
const exceptionDetails: inspector.Runtime.ExceptionDetails = params.exceptionDetails!;
|
||||
const resultClassName: string = params.result.className!;
|
||||
});
|
||||
session.post('Runtime.evaluate');
|
||||
|
||||
// General event
|
||||
session.on('inspectorNotification', message => {
|
||||
message; // $ExpectType InspectorNotification<{}>
|
||||
});
|
||||
// Known events
|
||||
session.on('Debugger.paused', (message: inspector.InspectorNotification<inspector.Debugger.PausedEventDataType>) => {
|
||||
const method: string = message.method;
|
||||
const pauseReason: string = message.params.reason;
|
||||
});
|
||||
session.on('Debugger.resumed', () => {});
|
||||
// Node Inspector events
|
||||
session.on('NodeTracing.dataCollected', (message: inspector.InspectorNotification<inspector.NodeTracing.DataCollectedEventDataType>) => {
|
||||
const value: Array<{}> = message.params.value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Trace Events Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const enabledCategories: string | undefined = trace_events.getEnabledCategories();
|
||||
const tracing: trace_events.Tracing = trace_events.createTracing({ categories: ['node', 'v8'] });
|
||||
const categories: string = tracing.categories;
|
||||
const enabled: boolean = tracing.enabled;
|
||||
tracing.enable();
|
||||
tracing.disable();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Node.js ESNEXT Support
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const s = 'foo';
|
||||
const s1: string = s.trimLeft();
|
||||
const s2: string = s.trimRight();
|
||||
const s3: string = s.trimStart();
|
||||
const s4: string = s.trimEnd();
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "esnext",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../../",
|
||||
"typeRoots": [
|
||||
"../../../"
|
||||
],
|
||||
"paths": {
|
||||
"node": [
|
||||
"node/v13"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"no-bad-reference": false,
|
||||
"no-empty-interface": false,
|
||||
"no-single-declare-module": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
194
types/node/v13/ts3.1/util.d.ts
vendored
194
types/node/v13/ts3.1/util.d.ts
vendored
@ -1,194 +0,0 @@
|
||||
declare module "util" {
|
||||
interface InspectOptions extends NodeJS.InspectOptions { }
|
||||
type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module';
|
||||
type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string;
|
||||
interface InspectOptionsStylized extends InspectOptions {
|
||||
stylize(text: string, styleType: Style): string;
|
||||
}
|
||||
function format(format: any, ...param: any[]): string;
|
||||
function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
|
||||
/** @deprecated since v0.11.3 - use a third party module instead. */
|
||||
function log(string: string): void;
|
||||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
function inspect(object: any, options: InspectOptions): string;
|
||||
namespace inspect {
|
||||
let colors: NodeJS.Dict<[number, number]>;
|
||||
let styles: {
|
||||
[K in Style]: string
|
||||
};
|
||||
let defaultOptions: InspectOptions;
|
||||
/**
|
||||
* Allows changing inspect settings from the repl.
|
||||
*/
|
||||
let replDefaults: InspectOptions;
|
||||
const custom: unique symbol;
|
||||
}
|
||||
/** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
|
||||
function isArray(object: any): object is any[];
|
||||
/** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
|
||||
function isDate(object: any): object is Date;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
|
||||
function isError(object: any): object is Error;
|
||||
function inherits(constructor: any, superConstructor: any): void;
|
||||
function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
|
||||
function isBoolean(object: any): object is boolean;
|
||||
/** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
|
||||
function isBuffer(object: any): object is Buffer;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
|
||||
function isFunction(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `value === null` instead. */
|
||||
function isNull(object: any): object is null;
|
||||
/** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
|
||||
function isNullOrUndefined(object: any): object is null | undefined;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
|
||||
function isNumber(object: any): object is number;
|
||||
/** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
|
||||
function isObject(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
|
||||
function isPrimitive(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
|
||||
function isString(object: any): object is string;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
|
||||
function isSymbol(object: any): object is symbol;
|
||||
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
|
||||
function isUndefined(object: any): object is undefined;
|
||||
function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
|
||||
function isDeepStrictEqual(val1: any, val2: any): boolean;
|
||||
|
||||
function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
|
||||
interface CustomPromisifyLegacy<TCustom extends Function> extends Function {
|
||||
__promisify__: TCustom;
|
||||
}
|
||||
|
||||
interface CustomPromisifySymbol<TCustom extends Function> extends Function {
|
||||
[promisify.custom]: TCustom;
|
||||
}
|
||||
|
||||
type CustomPromisify<TCustom extends Function> = CustomPromisifySymbol<TCustom> | CustomPromisifyLegacy<TCustom>;
|
||||
|
||||
function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
||||
function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
|
||||
function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
||||
function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
||||
function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
||||
function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
||||
function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
||||
function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
function promisify(fn: Function): Function;
|
||||
namespace promisify {
|
||||
const custom: unique symbol;
|
||||
}
|
||||
|
||||
namespace types {
|
||||
function isAnyArrayBuffer(object: any): boolean;
|
||||
function isArgumentsObject(object: any): object is IArguments;
|
||||
function isArrayBuffer(object: any): object is ArrayBuffer;
|
||||
function isArrayBufferView(object: any): object is ArrayBufferView;
|
||||
function isAsyncFunction(object: any): boolean;
|
||||
function isBooleanObject(object: any): object is Boolean;
|
||||
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
|
||||
function isDataView(object: any): object is DataView;
|
||||
function isDate(object: any): object is Date;
|
||||
function isExternal(object: any): boolean;
|
||||
function isFloat32Array(object: any): object is Float32Array;
|
||||
function isFloat64Array(object: any): object is Float64Array;
|
||||
function isGeneratorFunction(object: any): boolean;
|
||||
function isGeneratorObject(object: any): boolean;
|
||||
function isInt8Array(object: any): object is Int8Array;
|
||||
function isInt16Array(object: any): object is Int16Array;
|
||||
function isInt32Array(object: any): object is Int32Array;
|
||||
function isMap(object: any): boolean;
|
||||
function isMapIterator(object: any): boolean;
|
||||
function isModuleNamespaceObject(value: any): boolean;
|
||||
function isNativeError(object: any): object is Error;
|
||||
function isNumberObject(object: any): object is Number;
|
||||
function isPromise(object: any): boolean;
|
||||
function isProxy(object: any): boolean;
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
function isSet(object: any): boolean;
|
||||
function isSetIterator(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): boolean;
|
||||
function isStringObject(object: any): boolean;
|
||||
function isSymbolObject(object: any): boolean;
|
||||
function isTypedArray(object: any): object is NodeJS.TypedArray;
|
||||
function isUint8Array(object: any): object is Uint8Array;
|
||||
function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
||||
function isUint16Array(object: any): object is Uint16Array;
|
||||
function isUint32Array(object: any): object is Uint32Array;
|
||||
function isWeakMap(object: any): boolean;
|
||||
function isWeakSet(object: any): boolean;
|
||||
function isWebAssemblyCompiledModule(object: any): boolean;
|
||||
}
|
||||
|
||||
class TextDecoder {
|
||||
readonly encoding: string;
|
||||
readonly fatal: boolean;
|
||||
readonly ignoreBOM: boolean;
|
||||
constructor(
|
||||
encoding?: string,
|
||||
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
||||
);
|
||||
decode(
|
||||
input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
||||
options?: { stream?: boolean }
|
||||
): string;
|
||||
}
|
||||
|
||||
interface EncodeIntoResult {
|
||||
/**
|
||||
* The read Unicode code units of input.
|
||||
*/
|
||||
|
||||
read: number;
|
||||
/**
|
||||
* The written UTF-8 bytes of output.
|
||||
*/
|
||||
written: number;
|
||||
}
|
||||
|
||||
class TextEncoder {
|
||||
readonly encoding: string;
|
||||
encode(input?: string): Uint8Array;
|
||||
encodeInto(input: string, output: Uint8Array): EncodeIntoResult;
|
||||
}
|
||||
}
|
||||
46
types/node/v13/ts3.4/base.d.ts
vendored
46
types/node/v13/ts3.4/base.d.ts
vendored
@ -12,11 +12,43 @@
|
||||
/// <reference lib="esnext.intl" />
|
||||
/// <reference lib="esnext.bigint" />
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/base.d.ts" />
|
||||
|
||||
// TypeScript 3.2-specific augmentations:
|
||||
/// <reference path="../fs.d.ts" />
|
||||
/// <reference path="../util.d.ts" />
|
||||
// base definitions for all NodeJS modules that are not specific to any version of TypeScript
|
||||
/// <reference path="../globals.d.ts" />
|
||||
/// <reference path="../async_hooks.d.ts" />
|
||||
/// <reference path="../buffer.d.ts" />
|
||||
/// <reference path="../child_process.d.ts" />
|
||||
/// <reference path="../cluster.d.ts" />
|
||||
/// <reference path="../console.d.ts" />
|
||||
/// <reference path="../constants.d.ts" />
|
||||
/// <reference path="../crypto.d.ts" />
|
||||
/// <reference path="../dgram.d.ts" />
|
||||
/// <reference path="../dns.d.ts" />
|
||||
/// <reference path="../domain.d.ts" />
|
||||
/// <reference path="../events.d.ts" />
|
||||
/// <reference path="../fs.d.ts" />
|
||||
/// <reference path="../http.d.ts" />
|
||||
/// <reference path="../http2.d.ts" />
|
||||
/// <reference path="../https.d.ts" />
|
||||
/// <reference path="../inspector.d.ts" />
|
||||
/// <reference path="../module.d.ts" />
|
||||
/// <reference path="../net.d.ts" />
|
||||
/// <reference path="../os.d.ts" />
|
||||
/// <reference path="../path.d.ts" />
|
||||
/// <reference path="../perf_hooks.d.ts" />
|
||||
/// <reference path="../process.d.ts" />
|
||||
/// <reference path="../punycode.d.ts" />
|
||||
/// <reference path="../querystring.d.ts" />
|
||||
/// <reference path="../readline.d.ts" />
|
||||
/// <reference path="../repl.d.ts" />
|
||||
/// <reference path="../stream.d.ts" />
|
||||
/// <reference path="../string_decoder.d.ts" />
|
||||
/// <reference path="../timers.d.ts" />
|
||||
/// <reference path="../tls.d.ts" />
|
||||
/// <reference path="../trace_events.d.ts" />
|
||||
/// <reference path="../tty.d.ts" />
|
||||
/// <reference path="../url.d.ts" />
|
||||
/// <reference path="../util.d.ts" />
|
||||
/// <reference path="../v8.d.ts" />
|
||||
/// <reference path="../vm.d.ts" />
|
||||
/// <reference path="../worker_threads.d.ts" />
|
||||
/// <reference path="../zlib.d.ts" />
|
||||
|
||||
8
types/node/v13/ts3.4/index.d.ts
vendored
8
types/node/v13/ts3.4/index.d.ts
vendored
@ -4,9 +4,5 @@
|
||||
// Typically type modifiations should be made in base.d.ts instead of here
|
||||
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/assert.d.ts" />
|
||||
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/globals.global.d.ts" />
|
||||
/// <reference path="assert.d.ts" />
|
||||
/// <reference path="globals.global.d.ts" />
|
||||
|
||||
@ -1,31 +1,352 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
import '../ts3.1/node-tests';
|
||||
import '../ts3.1/assert';
|
||||
import '../ts3.1/buffer';
|
||||
import '../ts3.1/child_process';
|
||||
import '../ts3.1/cluster';
|
||||
import '../ts3.1/crypto';
|
||||
import '../ts3.1/dgram';
|
||||
import '../ts3.1/global';
|
||||
import '../ts3.1/http';
|
||||
import '../ts3.1/http2';
|
||||
import '../ts3.1/net';
|
||||
import '../ts3.1/os';
|
||||
import '../ts3.1/path';
|
||||
import '../ts3.1/perf_hooks';
|
||||
import '../ts3.1/process';
|
||||
import '../ts3.1/querystring';
|
||||
import '../ts3.1/readline';
|
||||
import '../ts3.1/repl';
|
||||
import '../ts3.1/stream';
|
||||
import '../ts3.1/tls';
|
||||
import '../ts3.1/tty';
|
||||
import '../ts3.1/util';
|
||||
import '../ts3.1/worker_threads';
|
||||
import '../ts3.1/zlib';
|
||||
import * as fs from "fs";
|
||||
import * as url from "url";
|
||||
import * as util from "util";
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
import * as console2 from "console";
|
||||
import * as timers from "timers";
|
||||
import * as inspector from "inspector";
|
||||
import * as trace_events from "trace_events";
|
||||
|
||||
import { types, promisify } from 'util';
|
||||
import { BigIntStats, statSync, Stats } from 'fs';
|
||||
//////////////////////////////////////////////////////
|
||||
/// Https tests : http://nodejs.org/api/https.html ///
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
let agent: https.Agent = new https.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 10000,
|
||||
maxSockets: Infinity,
|
||||
maxFreeSockets: 256,
|
||||
maxCachedSessions: 100,
|
||||
timeout: 15000
|
||||
});
|
||||
|
||||
agent = https.globalAgent;
|
||||
|
||||
https.request({
|
||||
agent: false
|
||||
});
|
||||
https.request({
|
||||
agent
|
||||
});
|
||||
https.request({
|
||||
agent: undefined
|
||||
});
|
||||
|
||||
https.get('http://www.example.com/xyz');
|
||||
https.request('http://www.example.com/xyz');
|
||||
|
||||
https.get('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
https.request('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'));
|
||||
https.request(new url.URL('http://www.example.com/xyz'));
|
||||
|
||||
https.get(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
|
||||
|
||||
const opts: https.RequestOptions = {
|
||||
path: '/some/path'
|
||||
};
|
||||
https.get(new url.URL('http://www.example.com'), opts);
|
||||
https.request(new url.URL('http://www.example.com'), opts);
|
||||
https.get(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
https.request(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
|
||||
|
||||
https.globalAgent.options.ca = [];
|
||||
|
||||
{
|
||||
function reqListener(req: http.IncomingMessage, res: http.ServerResponse): void {}
|
||||
|
||||
class MyIncomingMessage extends http.IncomingMessage {
|
||||
foo: number;
|
||||
}
|
||||
|
||||
class MyServerResponse extends http.ServerResponse {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
let server: https.Server;
|
||||
|
||||
server = new https.Server();
|
||||
server = new https.Server(reqListener);
|
||||
server = new https.Server({ IncomingMessage: MyIncomingMessage});
|
||||
|
||||
server = new https.Server({
|
||||
IncomingMessage: MyIncomingMessage,
|
||||
ServerResponse: MyServerResponse
|
||||
}, reqListener);
|
||||
|
||||
server = https.createServer();
|
||||
server = https.createServer(reqListener);
|
||||
server = https.createServer({ IncomingMessage: MyIncomingMessage });
|
||||
server = https.createServer({ ServerResponse: MyServerResponse }, reqListener);
|
||||
|
||||
const timeout: number = server.timeout;
|
||||
const listening: boolean = server.listening;
|
||||
const keepAliveTimeout: number = server.keepAliveTimeout;
|
||||
const maxHeadersCount: number | null = server.maxHeadersCount;
|
||||
const headersTimeout: number = server.headersTimeout;
|
||||
server.setTimeout().setTimeout(1000).setTimeout(() => {}).setTimeout(100, () => {});
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/// Timers tests : https://nodejs.org/api/timers.html
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const immediate = timers
|
||||
.setImmediate(() => {
|
||||
console.log('immediate');
|
||||
})
|
||||
.unref()
|
||||
.ref();
|
||||
const b: boolean = immediate.hasRef();
|
||||
timers.clearImmediate(immediate);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setInterval(() => {
|
||||
console.log('interval');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearInterval(timeout);
|
||||
}
|
||||
{
|
||||
const timeout = timers
|
||||
.setTimeout(() => {
|
||||
console.log('timeout');
|
||||
}, 20)
|
||||
.unref()
|
||||
.ref()
|
||||
.refresh();
|
||||
const b: boolean = timeout.hasRef();
|
||||
timers.clearTimeout(timeout);
|
||||
}
|
||||
async function testPromisify(doSomething: {
|
||||
(foo: any, onSuccessCallback: (result: string) => void, onErrorCallback: (reason: any) => void): void;
|
||||
[util.promisify.custom](foo: any): Promise<string>;
|
||||
}) {
|
||||
const setTimeout = util.promisify(timers.setTimeout);
|
||||
let v: void = await setTimeout(100); // tslint:disable-line no-void-expression void-return
|
||||
let s: string = await setTimeout(100, "");
|
||||
|
||||
const setImmediate = util.promisify(timers.setImmediate);
|
||||
v = await setImmediate(); // tslint:disable-line no-void-expression
|
||||
s = await setImmediate("");
|
||||
|
||||
// $ExpectType (foo: any) => Promise<string>
|
||||
const doSomethingPromise = util.promisify(doSomething);
|
||||
|
||||
// $ExpectType string
|
||||
s = await doSomethingPromise('foo');
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
/// Errors Tests : https://nodejs.org/api/errors.html ///
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
Error.stackTraceLimit = Infinity;
|
||||
}
|
||||
{
|
||||
const myObject = {};
|
||||
Error.captureStackTrace(myObject);
|
||||
}
|
||||
{
|
||||
const frames: NodeJS.CallSite[] = [];
|
||||
Error.prepareStackTrace!(new Error(), frames);
|
||||
}
|
||||
{
|
||||
const frame: NodeJS.CallSite = null!;
|
||||
const frameThis: any = frame.getThis();
|
||||
const typeName: string | null = frame.getTypeName();
|
||||
const func: Function | undefined = frame.getFunction();
|
||||
const funcName: string | null = frame.getFunctionName();
|
||||
const meth: string | null = frame.getMethodName();
|
||||
const fname: string | null = frame.getFileName();
|
||||
const lineno: number | null = frame.getLineNumber();
|
||||
const colno: number | null = frame.getColumnNumber();
|
||||
const evalOrigin: string | undefined = frame.getEvalOrigin();
|
||||
const isTop: boolean = frame.isToplevel();
|
||||
const isEval: boolean = frame.isEval();
|
||||
const isNative: boolean = frame.isNative();
|
||||
const isConstr: boolean = frame.isConstructor();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Console Tests : https://nodejs.org/api/console.html ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
let _c: Console = console;
|
||||
_c = console2;
|
||||
}
|
||||
{
|
||||
const writeStream = fs.createWriteStream('./index.d.ts');
|
||||
let consoleInstance: Console = new console.Console(writeStream);
|
||||
|
||||
consoleInstance = new console.Console(writeStream, writeStream);
|
||||
consoleInstance = new console.Console(writeStream, writeStream, true);
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
stderr: writeStream,
|
||||
colorMode: 'auto',
|
||||
ignoreErrors: true
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream,
|
||||
colorMode: false
|
||||
});
|
||||
consoleInstance = new console.Console({
|
||||
stdout: writeStream
|
||||
});
|
||||
}
|
||||
{
|
||||
console.assert('value');
|
||||
console.assert('value', 'message');
|
||||
console.assert('value', 'message', 'foo', 'bar');
|
||||
console.clear();
|
||||
console.count();
|
||||
console.count('label');
|
||||
console.countReset();
|
||||
console.countReset('label');
|
||||
console.debug();
|
||||
console.debug('message');
|
||||
console.debug('message', 'foo', 'bar');
|
||||
console.dir('obj');
|
||||
console.dir('obj', { depth: 1 });
|
||||
console.error();
|
||||
console.error('message');
|
||||
console.error('message', 'foo', 'bar');
|
||||
console.group();
|
||||
console.group('label');
|
||||
console.group('label1', 'label2');
|
||||
console.groupCollapsed();
|
||||
console.groupEnd();
|
||||
console.info();
|
||||
console.info('message');
|
||||
console.info('message', 'foo', 'bar');
|
||||
console.log();
|
||||
console.log('message');
|
||||
console.log('message', 'foo', 'bar');
|
||||
console.table({ foo: 'bar' });
|
||||
console.table([{ foo: 'bar' }]);
|
||||
console.table([{ foo: 'bar' }], ['foo']);
|
||||
console.time();
|
||||
console.time('label');
|
||||
console.timeEnd();
|
||||
console.timeEnd('label');
|
||||
console.timeLog();
|
||||
console.timeLog('label');
|
||||
console.timeLog('label', 'foo', 'bar');
|
||||
console.trace();
|
||||
console.trace('message');
|
||||
console.trace('message', 'foo', 'bar');
|
||||
console.warn();
|
||||
console.warn('message');
|
||||
console.warn('message', 'foo', 'bar');
|
||||
|
||||
// --- Inspector mode only ---
|
||||
console.profile();
|
||||
console.profile('label');
|
||||
console.profileEnd();
|
||||
console.profileEnd('label');
|
||||
console.timeStamp();
|
||||
console.timeStamp('label');
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* The following tests are the modules not mentioned in document but existed *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Inspector Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
{
|
||||
const b: inspector.Console.ConsoleMessage = {source: 'test', text: 'test', level: 'error' };
|
||||
inspector.open();
|
||||
inspector.open(0);
|
||||
inspector.open(0, 'localhost');
|
||||
inspector.open(0, 'localhost', true);
|
||||
inspector.close();
|
||||
const inspectorUrl: string | undefined = inspector.url();
|
||||
|
||||
const session = new inspector.Session();
|
||||
session.connect();
|
||||
session.disconnect();
|
||||
|
||||
// Unknown post method
|
||||
session.post('A.b', { key: 'value' }, (err, params) => {});
|
||||
// TODO: parameters are implicitly 'any' and need type annotation
|
||||
session.post('A.b', (err: Error | null, params?: {}) => {});
|
||||
session.post('A.b');
|
||||
// Known post method
|
||||
const parameter: inspector.Runtime.EvaluateParameterType = { expression: '2 + 2' };
|
||||
session.post('Runtime.evaluate', parameter,
|
||||
(err: Error | null, params: inspector.Runtime.EvaluateReturnType) => {});
|
||||
session.post('Runtime.evaluate', (err: Error, params: inspector.Runtime.EvaluateReturnType) => {
|
||||
const exceptionDetails: inspector.Runtime.ExceptionDetails = params.exceptionDetails!;
|
||||
const resultClassName: string = params.result.className!;
|
||||
});
|
||||
session.post('Runtime.evaluate');
|
||||
|
||||
// General event
|
||||
session.on('inspectorNotification', message => {
|
||||
message; // $ExpectType InspectorNotification<{}>
|
||||
});
|
||||
// Known events
|
||||
session.on('Debugger.paused', (message: inspector.InspectorNotification<inspector.Debugger.PausedEventDataType>) => {
|
||||
const method: string = message.method;
|
||||
const pauseReason: string = message.params.reason;
|
||||
});
|
||||
session.on('Debugger.resumed', () => {});
|
||||
// Node Inspector events
|
||||
session.on('NodeTracing.dataCollected', (message: inspector.InspectorNotification<inspector.NodeTracing.DataCollectedEventDataType>) => {
|
||||
const value: Array<{}> = message.params.value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Trace Events Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const enabledCategories: string | undefined = trace_events.getEnabledCategories();
|
||||
const tracing: trace_events.Tracing = trace_events.createTracing({ categories: ['node', 'v8'] });
|
||||
const categories: string = tracing.categories;
|
||||
const enabled: boolean = tracing.enabled;
|
||||
tracing.enable();
|
||||
tracing.disable();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Node.js ESNEXT Support
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
const s = 'foo';
|
||||
const s1: string = s.trimLeft();
|
||||
const s2: string = s.trimRight();
|
||||
const s3: string = s.trimStart();
|
||||
const s4: string = s.trimEnd();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
/// Global Tests : https://nodejs.org/api/global.html ///
|
||||
@ -39,10 +360,10 @@ import { BigIntStats, statSync, Stats } from 'fs';
|
||||
// Util Tests
|
||||
{
|
||||
const value: BigInt64Array | BigUint64Array | number = [] as any;
|
||||
if (types.isBigInt64Array(value)) {
|
||||
if (util.types.isBigInt64Array(value)) {
|
||||
// $ExpectType BigInt64Array
|
||||
const b = value;
|
||||
} else if (types.isBigUint64Array(value)) {
|
||||
} else if (util.types.isBigUint64Array(value)) {
|
||||
// $ExpectType BigUint64Array
|
||||
const b = value;
|
||||
} else {
|
||||
@ -50,15 +371,15 @@ import { BigIntStats, statSync, Stats } from 'fs';
|
||||
const b = value;
|
||||
}
|
||||
|
||||
const arg1UnknownError: (arg: string) => Promise<number> = promisify((arg: string, cb: (err: unknown, result: number) => void): void => { });
|
||||
const arg1AnyError: (arg: string) => Promise<number> = promisify((arg: string, cb: (err: any, result: number) => void): void => { });
|
||||
const arg1UnknownError: (arg: string) => Promise<number> = util.promisify((arg: string, cb: (err: unknown, result: number) => void): void => { });
|
||||
const arg1AnyError: (arg: string) => Promise<number> = util.promisify((arg: string, cb: (err: any, result: number) => void): void => { });
|
||||
}
|
||||
|
||||
// FS Tests
|
||||
{
|
||||
const bigStats: BigIntStats = statSync('.', { bigint: true });
|
||||
const bigStats: fs.BigIntStats = fs.statSync('.', { bigint: true });
|
||||
const bigIntStat: bigint = bigStats.atimeNs;
|
||||
const anyStats: Stats | BigIntStats = statSync('.', { bigint: Math.random() > 0.5 });
|
||||
const anyStats: fs.Stats | fs.BigIntStats = fs.statSync('.', { bigint: Math.random() > 0.5 });
|
||||
}
|
||||
|
||||
// Global Tests
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-bad-reference": false
|
||||
}
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"no-bad-reference": false,
|
||||
"no-empty-interface": false,
|
||||
"no-single-declare-module": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
|
||||
2
types/node/v13/ts3.6/index.d.ts
vendored
2
types/node/v13/ts3.6/index.d.ts
vendored
@ -5,4 +5,4 @@
|
||||
/// <reference path="base.d.ts" />
|
||||
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../ts3.1/assert.d.ts" />
|
||||
/// <reference path="../ts3.4/assert.d.ts" />
|
||||
|
||||
@ -1,29 +1,5 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
import '../ts3.4/node-tests';
|
||||
import '../ts3.1/assert';
|
||||
import '../ts3.1/buffer';
|
||||
import '../ts3.1/child_process';
|
||||
import '../ts3.1/cluster';
|
||||
import '../ts3.1/crypto';
|
||||
import '../ts3.1/dgram';
|
||||
import '../ts3.1/ts3.2/fs';
|
||||
import '../ts3.1/ts3.2/global';
|
||||
import '../ts3.1/http';
|
||||
import '../ts3.1/http2';
|
||||
import '../ts3.1/net';
|
||||
import '../ts3.1/os';
|
||||
import '../ts3.1/path';
|
||||
import '../ts3.1/perf_hooks';
|
||||
import '../ts3.1/process';
|
||||
import '../ts3.1/querystring';
|
||||
import '../ts3.1/readline';
|
||||
import '../ts3.1/repl';
|
||||
import '../ts3.1/stream';
|
||||
import '../ts3.1/tls';
|
||||
import '../ts3.1/tty';
|
||||
import '../ts3.1/ts3.2/util';
|
||||
import '../ts3.1/worker_threads';
|
||||
import '../ts3.1/zlib';
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/// WASI tests : https://nodejs.org/api/wasi.html ///
|
||||
|
||||
193
types/node/v13/util.d.ts
vendored
193
types/node/v13/util.d.ts
vendored
@ -1,9 +1,196 @@
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="ts3.1/util.d.ts" />
|
||||
|
||||
declare module "util" {
|
||||
interface InspectOptions extends NodeJS.InspectOptions { }
|
||||
type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module';
|
||||
type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string;
|
||||
interface InspectOptionsStylized extends InspectOptions {
|
||||
stylize(text: string, styleType: Style): string;
|
||||
}
|
||||
function format(format: any, ...param: any[]): string;
|
||||
function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
|
||||
/** @deprecated since v0.11.3 - use a third party module instead. */
|
||||
function log(string: string): void;
|
||||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
function inspect(object: any, options: InspectOptions): string;
|
||||
namespace inspect {
|
||||
let colors: NodeJS.Dict<[number, number]>;
|
||||
let styles: {
|
||||
[K in Style]: string
|
||||
};
|
||||
let defaultOptions: InspectOptions;
|
||||
/**
|
||||
* Allows changing inspect settings from the repl.
|
||||
*/
|
||||
let replDefaults: InspectOptions;
|
||||
const custom: unique symbol;
|
||||
}
|
||||
/** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
|
||||
function isArray(object: any): object is any[];
|
||||
/** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
|
||||
function isDate(object: any): object is Date;
|
||||
/** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
|
||||
function isError(object: any): object is Error;
|
||||
function inherits(constructor: any, superConstructor: any): void;
|
||||
function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
|
||||
function isBoolean(object: any): object is boolean;
|
||||
/** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
|
||||
function isBuffer(object: any): object is Buffer;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
|
||||
function isFunction(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `value === null` instead. */
|
||||
function isNull(object: any): object is null;
|
||||
/** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
|
||||
function isNullOrUndefined(object: any): object is null | undefined;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
|
||||
function isNumber(object: any): object is number;
|
||||
/** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
|
||||
function isObject(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
|
||||
function isPrimitive(object: any): boolean;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
|
||||
function isString(object: any): object is string;
|
||||
/** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
|
||||
function isSymbol(object: any): object is symbol;
|
||||
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
|
||||
function isUndefined(object: any): object is undefined;
|
||||
function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
|
||||
function isDeepStrictEqual(val1: any, val2: any): boolean;
|
||||
|
||||
function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
||||
function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
||||
|
||||
interface CustomPromisifyLegacy<TCustom extends Function> extends Function {
|
||||
__promisify__: TCustom;
|
||||
}
|
||||
|
||||
interface CustomPromisifySymbol<TCustom extends Function> extends Function {
|
||||
[promisify.custom]: TCustom;
|
||||
}
|
||||
|
||||
type CustomPromisify<TCustom extends Function> = CustomPromisifySymbol<TCustom> | CustomPromisifyLegacy<TCustom>;
|
||||
|
||||
function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
||||
function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
|
||||
function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
||||
function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
||||
function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
||||
function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
||||
function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
||||
function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void):
|
||||
(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
||||
function promisify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
||||
function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
function promisify(fn: Function): Function;
|
||||
namespace promisify {
|
||||
const custom: unique symbol;
|
||||
}
|
||||
|
||||
namespace types {
|
||||
function isAnyArrayBuffer(object: any): boolean;
|
||||
function isArgumentsObject(object: any): object is IArguments;
|
||||
function isArrayBuffer(object: any): object is ArrayBuffer;
|
||||
function isArrayBufferView(object: any): object is ArrayBufferView;
|
||||
function isAsyncFunction(object: any): boolean;
|
||||
function isBigInt64Array(value: any): value is BigInt64Array;
|
||||
function isBigUint64Array(value: any): value is BigUint64Array;
|
||||
function isBooleanObject(object: any): object is Boolean;
|
||||
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
|
||||
function isDataView(object: any): object is DataView;
|
||||
function isDate(object: any): object is Date;
|
||||
function isExternal(object: any): boolean;
|
||||
function isFloat32Array(object: any): object is Float32Array;
|
||||
function isFloat64Array(object: any): object is Float64Array;
|
||||
function isGeneratorFunction(object: any): boolean;
|
||||
function isGeneratorObject(object: any): boolean;
|
||||
function isInt8Array(object: any): object is Int8Array;
|
||||
function isInt16Array(object: any): object is Int16Array;
|
||||
function isInt32Array(object: any): object is Int32Array;
|
||||
function isMap(object: any): boolean;
|
||||
function isMapIterator(object: any): boolean;
|
||||
function isModuleNamespaceObject(value: any): boolean;
|
||||
function isNativeError(object: any): object is Error;
|
||||
function isNumberObject(object: any): object is Number;
|
||||
function isPromise(object: any): boolean;
|
||||
function isProxy(object: any): boolean;
|
||||
function isRegExp(object: any): object is RegExp;
|
||||
function isSet(object: any): boolean;
|
||||
function isSetIterator(object: any): boolean;
|
||||
function isSharedArrayBuffer(object: any): boolean;
|
||||
function isStringObject(object: any): boolean;
|
||||
function isSymbolObject(object: any): boolean;
|
||||
function isTypedArray(object: any): object is NodeJS.TypedArray;
|
||||
function isUint8Array(object: any): object is Uint8Array;
|
||||
function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
||||
function isUint16Array(object: any): object is Uint16Array;
|
||||
function isUint32Array(object: any): object is Uint32Array;
|
||||
function isWeakMap(object: any): boolean;
|
||||
function isWeakSet(object: any): boolean;
|
||||
function isWebAssemblyCompiledModule(object: any): boolean;
|
||||
}
|
||||
|
||||
class TextDecoder {
|
||||
readonly encoding: string;
|
||||
readonly fatal: boolean;
|
||||
readonly ignoreBOM: boolean;
|
||||
constructor(
|
||||
encoding?: string,
|
||||
options?: { fatal?: boolean; ignoreBOM?: boolean }
|
||||
);
|
||||
decode(
|
||||
input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
||||
options?: { stream?: boolean }
|
||||
): string;
|
||||
}
|
||||
|
||||
interface EncodeIntoResult {
|
||||
/**
|
||||
* The read Unicode code units of input.
|
||||
*/
|
||||
|
||||
read: number;
|
||||
/**
|
||||
* The written UTF-8 bytes of output.
|
||||
*/
|
||||
written: number;
|
||||
}
|
||||
|
||||
class TextEncoder {
|
||||
readonly encoding: string;
|
||||
encode(input?: string): Uint8Array;
|
||||
encodeInto(input: string, output: Uint8Array): EncodeIntoResult;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"types": "index",
|
||||
"typesVersions": {
|
||||
"<=3.1": {
|
||||
"*": [
|
||||
"ts3.1/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
38
types/node/v6/ts3.1/index.d.ts
vendored
38
types/node/v6/ts3.1/index.d.ts
vendored
@ -1,38 +0,0 @@
|
||||
/************************************************
|
||||
* *
|
||||
* Node.js v6.x API *
|
||||
* *
|
||||
************************************************/
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.1.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
|
||||
// - ~/ts3.1/index.d.ts - Definitions specific to TypeScript 3.1
|
||||
|
||||
// NOTE: Augmentations for TypeScript 3.1 and later should use individual files for overrides
|
||||
// within the respective ~/ts3.1 (or later) folder. However, this is disallowed for versions
|
||||
// prior to TypeScript 3.1, so the older definitions will be found here.
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../base.d.ts" />
|
||||
|
||||
// TypeScript 2.1-specific augmentations:
|
||||
|
||||
// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
|
||||
interface MapConstructor { }
|
||||
interface WeakMapConstructor { }
|
||||
interface SetConstructor { }
|
||||
interface WeakSetConstructor { }
|
||||
interface Iterable<T> { }
|
||||
interface Iterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
}
|
||||
interface IterableIterator<T> { }
|
||||
interface IteratorResult<T> { }
|
||||
interface AsyncIterableIterator<T> {}
|
||||
interface SymbolConstructor {
|
||||
readonly iterator: symbol;
|
||||
}
|
||||
declare var Symbol: SymbolConstructor;
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,30 +0,0 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../../",
|
||||
"typeRoots": [
|
||||
"../../../"
|
||||
],
|
||||
"paths": {
|
||||
"node": [
|
||||
"node/v6"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"align": false,
|
||||
"array-type": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"import-spacing": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-const-enum": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-namespace": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-var-keyword": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-const": false,
|
||||
"prefer-method-signature": false,
|
||||
"semicolon": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"types": "index",
|
||||
"typesVersions": {
|
||||
"<=3.1": {
|
||||
"*": [
|
||||
"ts3.1/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
37
types/node/v7/ts3.1/index.d.ts
vendored
37
types/node/v7/ts3.1/index.d.ts
vendored
@ -1,37 +0,0 @@
|
||||
/************************************************
|
||||
* *
|
||||
* Node.js v7.x API *
|
||||
* *
|
||||
************************************************/
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.1.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
|
||||
// - ~/ts3.1/index.d.ts - Definitions specific to TypeScript 3.1
|
||||
|
||||
// NOTE: Augmentations for TypeScript 3.1 and later should use individual files for overrides
|
||||
// within the respective ~/ts3.1 (or later) folder. However, this is disallowed for versions
|
||||
// prior to TypeScript 3.1, so the older definitions will be found here.
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
// tslint:disable-next-line:no-bad-reference
|
||||
/// <reference path="../base.d.ts" />
|
||||
|
||||
// TypeScript 2.1-specific augmentations:
|
||||
|
||||
// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
|
||||
interface MapConstructor { }
|
||||
interface WeakMapConstructor { }
|
||||
interface SetConstructor { }
|
||||
interface WeakSetConstructor { }
|
||||
interface IteratorResult<T> {}
|
||||
interface Iterable<T> {}
|
||||
interface Iterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
}
|
||||
interface IterableIterator<T> { }
|
||||
interface SymbolConstructor {
|
||||
readonly iterator: symbol;
|
||||
}
|
||||
declare var Symbol: SymbolConstructor;
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,30 +0,0 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../../",
|
||||
"typeRoots": [
|
||||
"../../../"
|
||||
],
|
||||
"paths": {
|
||||
"node": [
|
||||
"node/v7"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"align": false,
|
||||
"array-type": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"import-spacing": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-namespace": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-var-keyword": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-const": false,
|
||||
"prefer-method-signature": false,
|
||||
"semicolon": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user