@types/node 14.0.15 → 14.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/README.md CHANGED
@@ -8,9 +8,9 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 06 Jul 2020 20:44:09 GMT
11
+ * Last updated: Tue, 07 Jul 2020 17:24:48 GMT
12
12
  * Dependencies: none
13
- * Global values: `Buffer`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
13
+ * Global values: `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `exports`, `global`, `module`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14
14
 
15
15
  # Credits
16
16
  These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alexander T.](https://github.com/a-tarasyuk), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Bruno Scheufler](https://github.com/brunoscheufler), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Flarna](https://github.com/Flarna), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nicolas Voigt](https://github.com/octo-sniffle), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Jordi Oliveras Rovira](https://github.com/j-oliveras), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), and [Jason Kwok](https://github.com/JasonHK).
node/buffer.d.ts CHANGED
@@ -6,7 +6,6 @@ declare module "buffer" {
6
6
  MAX_LENGTH: number;
7
7
  MAX_STRING_LENGTH: number;
8
8
  };
9
- const BuffType: typeof Buffer;
10
9
 
11
10
  export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary";
12
11
 
@@ -18,5 +17,244 @@ declare module "buffer" {
18
17
  prototype: Buffer;
19
18
  };
20
19
 
21
- export { BuffType as Buffer };
20
+ global {
21
+ // Buffer class
22
+ type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
23
+
24
+ /**
25
+ * Raw data is stored in instances of the Buffer class.
26
+ * 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.
27
+ * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
28
+ */
29
+ class Buffer extends Uint8Array {
30
+ /**
31
+ * Allocates a new buffer containing the given {str}.
32
+ *
33
+ * @param str String to store in buffer.
34
+ * @param encoding encoding to use, optional. Default is 'utf8'
35
+ * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
36
+ */
37
+ constructor(str: string, encoding?: BufferEncoding);
38
+ /**
39
+ * Allocates a new buffer of {size} octets.
40
+ *
41
+ * @param size count of octets to allocate.
42
+ * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
43
+ */
44
+ constructor(size: number);
45
+ /**
46
+ * Allocates a new buffer containing the given {array} of octets.
47
+ *
48
+ * @param array The octets to store.
49
+ * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
50
+ */
51
+ constructor(array: Uint8Array);
52
+ /**
53
+ * Produces a Buffer backed by the same allocated memory as
54
+ * the given {ArrayBuffer}/{SharedArrayBuffer}.
55
+ *
56
+ *
57
+ * @param arrayBuffer The ArrayBuffer with which to share memory.
58
+ * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
59
+ */
60
+ constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer);
61
+ /**
62
+ * Allocates a new buffer containing the given {array} of octets.
63
+ *
64
+ * @param array The octets to store.
65
+ * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
66
+ */
67
+ constructor(array: any[]);
68
+ /**
69
+ * Copies the passed {buffer} data onto a new {Buffer} instance.
70
+ *
71
+ * @param buffer The buffer to copy.
72
+ * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
73
+ */
74
+ constructor(buffer: Buffer);
75
+ /**
76
+ * When passed a reference to the .buffer property of a TypedArray instance,
77
+ * the newly created Buffer will share the same allocated memory as the TypedArray.
78
+ * The optional {byteOffset} and {length} arguments specify a memory range
79
+ * within the {arrayBuffer} that will be shared by the Buffer.
80
+ *
81
+ * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer()
82
+ */
83
+ static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;
84
+ /**
85
+ * Creates a new Buffer using the passed {data}
86
+ * @param data data to create a new Buffer
87
+ */
88
+ static from(data: number[]): Buffer;
89
+ static from(data: Uint8Array): Buffer;
90
+ /**
91
+ * Creates a new buffer containing the coerced value of an object
92
+ * A `TypeError` will be thrown if {obj} has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants.
93
+ * @param obj An object supporting `Symbol.toPrimitive` or `valueOf()`.
94
+ */
95
+ static from(obj: { valueOf(): string | object } | { [Symbol.toPrimitive](hint: 'string'): string }, byteOffset?: number, length?: number): Buffer;
96
+ /**
97
+ * Creates a new Buffer containing the given JavaScript string {str}.
98
+ * If provided, the {encoding} parameter identifies the character encoding.
99
+ * If not provided, {encoding} defaults to 'utf8'.
100
+ */
101
+ static from(str: string, encoding?: BufferEncoding): Buffer;
102
+ /**
103
+ * Creates a new Buffer using the passed {data}
104
+ * @param values to create a new Buffer
105
+ */
106
+ static of(...items: number[]): Buffer;
107
+ /**
108
+ * Returns true if {obj} is a Buffer
109
+ *
110
+ * @param obj object to test.
111
+ */
112
+ static isBuffer(obj: any): obj is Buffer;
113
+ /**
114
+ * Returns true if {encoding} is a valid encoding argument.
115
+ * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
116
+ *
117
+ * @param encoding string to test.
118
+ */
119
+ static isEncoding(encoding: string): encoding is BufferEncoding;
120
+ /**
121
+ * Gives the actual byte length of a string. encoding defaults to 'utf8'.
122
+ * This is not the same as String.prototype.length since that returns the number of characters in a string.
123
+ *
124
+ * @param string string to test.
125
+ * @param encoding encoding used to evaluate (defaults to 'utf8')
126
+ */
127
+ static byteLength(
128
+ string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
129
+ encoding?: BufferEncoding
130
+ ): number;
131
+ /**
132
+ * Returns a buffer which is the result of concatenating all the buffers in the list together.
133
+ *
134
+ * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
135
+ * If the list has exactly one item, then the first item of the list is returned.
136
+ * If the list has more than one item, then a new Buffer is created.
137
+ *
138
+ * @param list An array of Buffer objects to concatenate
139
+ * @param totalLength Total length of the buffers when concatenated.
140
+ * 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.
141
+ */
142
+ static concat(list: Uint8Array[], totalLength?: number): Buffer;
143
+ /**
144
+ * The same as buf1.compare(buf2).
145
+ */
146
+ static compare(buf1: Uint8Array, buf2: Uint8Array): number;
147
+ /**
148
+ * Allocates a new buffer of {size} octets.
149
+ *
150
+ * @param size count of octets to allocate.
151
+ * @param fill if specified, buffer will be initialized by calling buf.fill(fill).
152
+ * If parameter is omitted, buffer will be filled with zeros.
153
+ * @param encoding encoding used for call to buf.fill while initalizing
154
+ */
155
+ static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
156
+ /**
157
+ * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
158
+ * of the newly created Buffer are unknown and may contain sensitive data.
159
+ *
160
+ * @param size count of octets to allocate
161
+ */
162
+ static allocUnsafe(size: number): Buffer;
163
+ /**
164
+ * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
165
+ * of the newly created Buffer are unknown and may contain sensitive data.
166
+ *
167
+ * @param size count of octets to allocate
168
+ */
169
+ static allocUnsafeSlow(size: number): Buffer;
170
+ /**
171
+ * 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.
172
+ */
173
+ static poolSize: number;
174
+
175
+ write(string: string, encoding?: BufferEncoding): number;
176
+ write(string: string, offset: number, encoding?: BufferEncoding): number;
177
+ write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
178
+ toString(encoding?: BufferEncoding, start?: number, end?: number): string;
179
+ toJSON(): { type: 'Buffer'; data: number[] };
180
+ equals(otherBuffer: Uint8Array): boolean;
181
+ compare(
182
+ otherBuffer: Uint8Array,
183
+ targetStart?: number,
184
+ targetEnd?: number,
185
+ sourceStart?: number,
186
+ sourceEnd?: number
187
+ ): number;
188
+ copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
189
+ /**
190
+ * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
191
+ *
192
+ * This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory.
193
+ *
194
+ * @param begin Where the new `Buffer` will start. Default: `0`.
195
+ * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
196
+ */
197
+ slice(begin?: number, end?: number): Buffer;
198
+ /**
199
+ * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
200
+ *
201
+ * This method is compatible with `Uint8Array#subarray()`.
202
+ *
203
+ * @param begin Where the new `Buffer` will start. Default: `0`.
204
+ * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
205
+ */
206
+ subarray(begin?: number, end?: number): Buffer;
207
+ writeUIntLE(value: number, offset: number, byteLength: number): number;
208
+ writeUIntBE(value: number, offset: number, byteLength: number): number;
209
+ writeIntLE(value: number, offset: number, byteLength: number): number;
210
+ writeIntBE(value: number, offset: number, byteLength: number): number;
211
+ readUIntLE(offset: number, byteLength: number): number;
212
+ readUIntBE(offset: number, byteLength: number): number;
213
+ readIntLE(offset: number, byteLength: number): number;
214
+ readIntBE(offset: number, byteLength: number): number;
215
+ readUInt8(offset?: number): number;
216
+ readUInt16LE(offset?: number): number;
217
+ readUInt16BE(offset?: number): number;
218
+ readUInt32LE(offset?: number): number;
219
+ readUInt32BE(offset?: number): number;
220
+ readInt8(offset?: number): number;
221
+ readInt16LE(offset?: number): number;
222
+ readInt16BE(offset?: number): number;
223
+ readInt32LE(offset?: number): number;
224
+ readInt32BE(offset?: number): number;
225
+ readFloatLE(offset?: number): number;
226
+ readFloatBE(offset?: number): number;
227
+ readDoubleLE(offset?: number): number;
228
+ readDoubleBE(offset?: number): number;
229
+ reverse(): this;
230
+ swap16(): Buffer;
231
+ swap32(): Buffer;
232
+ swap64(): Buffer;
233
+ writeUInt8(value: number, offset?: number): number;
234
+ writeUInt16LE(value: number, offset?: number): number;
235
+ writeUInt16BE(value: number, offset?: number): number;
236
+ writeUInt32LE(value: number, offset?: number): number;
237
+ writeUInt32BE(value: number, offset?: number): number;
238
+ writeInt8(value: number, offset?: number): number;
239
+ writeInt16LE(value: number, offset?: number): number;
240
+ writeInt16BE(value: number, offset?: number): number;
241
+ writeInt32LE(value: number, offset?: number): number;
242
+ writeInt32BE(value: number, offset?: number): number;
243
+ writeFloatLE(value: number, offset?: number): number;
244
+ writeFloatBE(value: number, offset?: number): number;
245
+ writeDoubleLE(value: number, offset?: number): number;
246
+ writeDoubleBE(value: number, offset?: number): number;
247
+
248
+ fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
249
+
250
+ indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
251
+ lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
252
+ entries(): IterableIterator<[number, number]>;
253
+ includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
254
+ keys(): IterableIterator<number>;
255
+ values(): IterableIterator<number>;
256
+ }
257
+ }
258
+
259
+ export { Buffer };
22
260
  }
node/console.d.ts CHANGED
@@ -1,3 +1,133 @@
1
1
  declare module "console" {
2
+ import { InspectOptions } from 'util';
3
+
4
+ global {
5
+ // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
6
+ interface Console {
7
+ Console: NodeJS.ConsoleConstructor;
8
+ /**
9
+ * A simple assertion test that verifies whether `value` is truthy.
10
+ * If it is not, an `AssertionError` is thrown.
11
+ * If provided, the error `message` is formatted using `util.format()` and used as the error message.
12
+ */
13
+ assert(value: any, message?: string, ...optionalParams: any[]): void;
14
+ /**
15
+ * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY.
16
+ * When `stdout` is not a TTY, this method does nothing.
17
+ */
18
+ clear(): void;
19
+ /**
20
+ * Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`.
21
+ */
22
+ count(label?: string): void;
23
+ /**
24
+ * Resets the internal counter specific to `label`.
25
+ */
26
+ countReset(label?: string): void;
27
+ /**
28
+ * The `console.debug()` function is an alias for {@link console.log()}.
29
+ */
30
+ debug(message?: any, ...optionalParams: any[]): void;
31
+ /**
32
+ * Uses {@link util.inspect()} on `obj` and prints the resulting string to `stdout`.
33
+ * This function bypasses any custom `inspect()` function defined on `obj`.
34
+ */
35
+ dir(obj: any, options?: InspectOptions): void;
36
+ /**
37
+ * This method calls {@link console.log()} passing it the arguments received. Please note that this method does not produce any XML formatting
38
+ */
39
+ dirxml(...data: any[]): void;
40
+ /**
41
+ * Prints to `stderr` with newline.
42
+ */
43
+ error(message?: any, ...optionalParams: any[]): void;
44
+ /**
45
+ * Increases indentation of subsequent lines by two spaces.
46
+ * If one or more `label`s are provided, those are printed first without the additional indentation.
47
+ */
48
+ group(...label: any[]): void;
49
+ /**
50
+ * The `console.groupCollapsed()` function is an alias for {@link console.group()}.
51
+ */
52
+ groupCollapsed(...label: any[]): void;
53
+ /**
54
+ * Decreases indentation of subsequent lines by two spaces.
55
+ */
56
+ groupEnd(): void;
57
+ /**
58
+ * The {@link console.info()} function is an alias for {@link console.log()}.
59
+ */
60
+ info(message?: any, ...optionalParams: any[]): void;
61
+ /**
62
+ * Prints to `stdout` with newline.
63
+ */
64
+ log(message?: any, ...optionalParams: any[]): void;
65
+ /**
66
+ * This method does not display anything unless used in the inspector.
67
+ * Prints to `stdout` the array `array` formatted as a table.
68
+ */
69
+ table(tabularData: any, properties?: string[]): void;
70
+ /**
71
+ * Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`.
72
+ */
73
+ time(label?: string): void;
74
+ /**
75
+ * Stops a timer that was previously started by calling {@link console.time()} and prints the result to `stdout`.
76
+ */
77
+ timeEnd(label?: string): void;
78
+ /**
79
+ * For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`.
80
+ */
81
+ timeLog(label?: string, ...data: any[]): void;
82
+ /**
83
+ * Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code.
84
+ */
85
+ trace(message?: any, ...optionalParams: any[]): void;
86
+ /**
87
+ * The {@link console.warn()} function is an alias for {@link console.error()}.
88
+ */
89
+ warn(message?: any, ...optionalParams: any[]): void;
90
+
91
+ // --- Inspector mode only ---
92
+ /**
93
+ * This method does not display anything unless used in the inspector.
94
+ * Starts a JavaScript CPU profile with an optional label.
95
+ */
96
+ profile(label?: string): void;
97
+ /**
98
+ * This method does not display anything unless used in the inspector.
99
+ * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
100
+ */
101
+ profileEnd(label?: string): void;
102
+ /**
103
+ * This method does not display anything unless used in the inspector.
104
+ * Adds an event with the label `label` to the Timeline panel of the inspector.
105
+ */
106
+ timeStamp(label?: string): void;
107
+ }
108
+
109
+ var console: Console;
110
+
111
+ namespace NodeJS {
112
+ interface ConsoleConstructorOptions {
113
+ stdout: WritableStream;
114
+ stderr?: WritableStream;
115
+ ignoreErrors?: boolean;
116
+ colorMode?: boolean | 'auto';
117
+ inspectOptions?: InspectOptions;
118
+ }
119
+
120
+ interface ConsoleConstructor {
121
+ prototype: Console;
122
+ new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console;
123
+ new(options: ConsoleConstructorOptions): Console;
124
+ }
125
+
126
+ interface Global {
127
+ console: typeof console;
128
+ }
129
+ }
130
+ }
131
+
2
132
  export = console;
3
133
  }
node/domain.d.ts CHANGED
@@ -1,12 +1,20 @@
1
1
  declare module "domain" {
2
2
  import { EventEmitter } from "events";
3
3
 
4
- class Domain extends EventEmitter implements NodeJS.Domain {
5
- run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
6
- add(emitter: EventEmitter | NodeJS.Timer): void;
7
- remove(emitter: EventEmitter | NodeJS.Timer): void;
8
- bind<T extends Function>(cb: T): T;
9
- intercept<T extends Function>(cb: T): T;
4
+ global {
5
+ namespace NodeJS {
6
+ interface Domain extends EventEmitter {
7
+ run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
8
+ add(emitter: EventEmitter | Timer): void;
9
+ remove(emitter: EventEmitter | Timer): void;
10
+ bind<T extends Function>(cb: T): T;
11
+ intercept<T extends Function>(cb: T): T;
12
+ }
13
+ }
14
+ }
15
+
16
+ interface Domain extends NodeJS.Domain {}
17
+ class Domain extends EventEmitter {
10
18
  members: Array<EventEmitter | NodeJS.Timer>;
11
19
  enter(): void;
12
20
  exit(): void;
node/events.d.ts CHANGED
@@ -56,5 +56,28 @@ declare module "events" {
56
56
  }
57
57
  }
58
58
 
59
+ global {
60
+ namespace NodeJS {
61
+ interface EventEmitter {
62
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
63
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
64
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
65
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
66
+ off(event: string | symbol, listener: (...args: any[]) => void): this;
67
+ removeAllListeners(event?: string | symbol): this;
68
+ setMaxListeners(n: number): this;
69
+ getMaxListeners(): number;
70
+ listeners(event: string | symbol): Function[];
71
+ rawListeners(event: string | symbol): Function[];
72
+ emit(event: string | symbol, ...args: any[]): boolean;
73
+ listenerCount(type: string | symbol): number;
74
+ // Added in Node 6...
75
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
76
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
77
+ eventNames(): Array<string | symbol>;
78
+ }
79
+ }
80
+ }
81
+
59
82
  export = EventEmitter;
60
83
  }