Completed
Push — master ( 0dd02f...6db2b4 )
by Dimas
45:39 queued 27:24
created

libs/typings/node/globals.d.ts   F

Complexity

Total Complexity 82
Complexity/F 1

Size

Lines of Code 1110
Function Count 82

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 720
dl 0
loc 1110
rs 1.88
c 0
b 0
f 0
wmc 82
mnd 0
bc 0
fnc 82
bpm 0
cpm 1
noi 0

72 Functions

Rating   Name   Duplication   Size   Complexity  
A Buffer.values 0 1 1
A Buffer.readUInt8 0 1 1
A Buffer.byteLength 0 11 1
A Buffer.equals 0 1 1
A Buffer.readUInt16LE 0 1 1
A Buffer.readUInt16BE 0 1 1
A Buffer.subarray 0 9 1
A Buffer.reverse 0 1 1
A Buffer.readInt32BE 0 1 1
A Buffer.allocUnsafe 0 7 1
A Buffer.readUInt32BE 0 1 1
A Buffer.slice 0 9 1
A Buffer.compare 0 4 1
A Buffer.copy 0 1 1
A Buffer.swap32 0 1 1
A Buffer.writeDoubleLE 0 1 1
A Buffer.readDoubleBE 0 1 1
A Buffer.writeFloatBE 0 1 1
A Buffer.readIntBE 0 1 1
A Buffer.writeUInt16LE 0 1 1
A Buffer.readInt32LE 0 1 1
A Buffer.write 0 2 1
A Buffer.isBuffer 0 6 1
A Buffer.from 0 9 1
A Buffer.readInt16BE 0 1 1
A Buffer.keys 0 1 1
A Buffer.isEncoding 0 7 1
A Buffer.readUInt32LE 0 1 1
A globals.d.ts ➔ clearTimeout 0 1 1
A Buffer.writeInt8 0 1 1
A Buffer.writeInt16LE 0 1 1
A Buffer.includes 0 1 1
A Buffer.entries 0 1 1
A Buffer.of 0 5 1
A Buffer.toString 0 1 1
A Buffer.writeUInt32BE 0 1 1
A Buffer.writeUIntBE 0 1 1
A Buffer.writeFloatLE 0 1 1
A Buffer.readUIntLE 0 1 1
A Buffer.indexOf 0 2 1
A globals.d.ts ➔ clearImmediate 0 1 1
A Buffer.writeUIntLE 0 1 1
A Buffer.writeIntLE 0 1 1
A globals.d.ts ➔ ___promisify__ 0 1 1
A Buffer.swap16 0 1 1
A Buffer.writeInt32BE 0 1 1
A Buffer.toJSON 0 1 1
A Buffer.allocUnsafeSlow 0 7 1
A globals.d.ts ➔ queueMicrotask 0 2 1
A globals.d.ts ➔ setInterval 0 1 1
A Buffer.writeDoubleBE 0 1 1
A Buffer.readInt16LE 0 1 1
A Buffer.lastIndexOf 0 1 1
A Buffer.writeUInt16BE 0 1 1
A Buffer.swap64 0 1 1
A Buffer.readFloatLE 0 1 1
A Buffer.readInt8 0 1 1
A globals.d.ts ➔ setImmediate 0 1 1
A Buffer.writeIntBE 0 1 1
A Buffer.writeInt16BE 0 1 1
A Buffer.writeUInt8 0 1 1
A Buffer.readDoubleLE 0 1 1
A globals.d.ts ➔ setTimeout 0 2 1
A Buffer.readUIntBE 0 1 1
A Buffer.writeInt32LE 0 1 1
A globals.d.ts ➔ clearInterval 0 1 1
A Buffer.alloc 0 9 1
A Buffer.concat 0 12 1
A Buffer.readFloatBE 0 1 1
A Buffer.readIntLE 0 1 1
A Buffer.fill 0 2 1
A Buffer.writeUInt32LE 0 1 1

How to fix   Complexity   

Complexity

Complex classes like libs/typings/node/globals.d.ts often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
2
interface Console {
3
    Console: NodeJS.ConsoleConstructor;
4
    /**
5
     * A simple assertion test that verifies whether `value` is truthy.
6
     * If it is not, an `AssertionError` is thrown.
7
     * If provided, the error `message` is formatted using `util.format()` and used as the error message.
8
     */
9
    assert(value: any, message?: string, ...optionalParams: any[]): void;
10
    /**
11
     * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY.
12
     * When `stdout` is not a TTY, this method does nothing.
13
     */
14
    clear(): void;
15
    /**
16
     * Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`.
17
     */
18
    count(label?: string): void;
19
    /**
20
     * Resets the internal counter specific to `label`.
21
     */
22
    countReset(label?: string): void;
23
    /**
24
     * The `console.debug()` function is an alias for {@link console.log()}.
25
     */
26
    debug(message?: any, ...optionalParams: any[]): void;
27
    /**
28
     * Uses {@link util.inspect()} on `obj` and prints the resulting string to `stdout`.
29
     * This function bypasses any custom `inspect()` function defined on `obj`.
30
     */
31
    dir(obj: any, options?: NodeJS.InspectOptions): void;
32
    /**
33
     * This method calls {@link console.log()} passing it the arguments received. Please note that this method does not produce any XML formatting
34
     */
35
    dirxml(...data: any[]): void;
36
    /**
37
     * Prints to `stderr` with newline.
38
     */
39
    error(message?: any, ...optionalParams: any[]): void;
40
    /**
41
     * Increases indentation of subsequent lines by two spaces.
42
     * If one or more `label`s are provided, those are printed first without the additional indentation.
43
     */
44
    group(...label: any[]): void;
45
    /**
46
     * The `console.groupCollapsed()` function is an alias for {@link console.group()}.
47
     */
48
    groupCollapsed(...label: any[]): void;
49
    /**
50
     * Decreases indentation of subsequent lines by two spaces.
51
     */
52
    groupEnd(): void;
53
    /**
54
     * The {@link console.info()} function is an alias for {@link console.log()}.
55
     */
56
    info(message?: any, ...optionalParams: any[]): void;
57
    /**
58
     * Prints to `stdout` with newline.
59
     */
60
    log(message?: any, ...optionalParams: any[]): void;
61
    /**
62
     * This method does not display anything unless used in the inspector.
63
     *  Prints to `stdout` the array `array` formatted as a table.
64
     */
65
    table(tabularData: any, properties?: string[]): void;
66
    /**
67
     * Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`.
68
     */
69
    time(label?: string): void;
70
    /**
71
     * Stops a timer that was previously started by calling {@link console.time()} and prints the result to `stdout`.
72
     */
73
    timeEnd(label?: string): void;
74
    /**
75
     * For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`.
76
     */
77
    timeLog(label?: string, ...data: any[]): void;
78
    /**
79
     * Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code.
80
     */
81
    trace(message?: any, ...optionalParams: any[]): void;
82
    /**
83
     * The {@link console.warn()} function is an alias for {@link console.error()}.
84
     */
85
    warn(message?: any, ...optionalParams: any[]): void;
86
87
    // --- Inspector mode only ---
88
    /**
89
     * This method does not display anything unless used in the inspector.
90
     *  Starts a JavaScript CPU profile with an optional label.
91
     */
92
    profile(label?: string): void;
93
    /**
94
     * This method does not display anything unless used in the inspector.
95
     *  Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
96
     */
97
    profileEnd(label?: string): void;
98
    /**
99
     * This method does not display anything unless used in the inspector.
100
     *  Adds an event with the label `label` to the Timeline panel of the inspector.
101
     */
102
    timeStamp(label?: string): void;
103
}
104
105
// Declare "static" methods in Error
106
interface ErrorConstructor {
107
    /** Create .stack property on a target object */
108
    captureStackTrace(targetObject: object, constructorOpt?: Function): void;
109
110
    /**
111
     * Optional override for formatting stack traces
112
     *
113
     * @see https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces
114
     */
115
    prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
116
117
    stackTraceLimit: number;
118
}
119
120
// Node.js ESNEXT support
121
interface String {
122
    /** Removes whitespace from the left end of a string. */
123
    trimLeft(): string;
124
    /** Removes whitespace from the right end of a string. */
125
    trimRight(): string;
126
}
127
128
interface ImportMeta {
129
    url: string;
130
}
131
132
/*-----------------------------------------------*
133
 *                                               *
134
 *                   GLOBAL                      *
135
 *                                               *
136
 ------------------------------------------------*/
137
138
// For backwards compability
139
interface NodeRequire extends NodeJS.Require {}
140
interface RequireResolve extends NodeJS.RequireResolve {}
141
interface NodeModule extends NodeJS.Module {}
142
143
declare var process: NodeJS.Process;
144
declare var console: Console;
145
146
declare var __filename: string;
147
declare var __dirname: string;
148
149
declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
150
declare namespace setTimeout {
151
    function __promisify__(ms: number): Promise<void>;
152
    function __promisify__<T>(ms: number, value: T): Promise<T>;
153
}
154
declare function clearTimeout(timeoutId: NodeJS.Timeout): void;
155
declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
156
declare function clearInterval(intervalId: NodeJS.Timeout): void;
157
declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate;
158
declare namespace setImmediate {
159
    function __promisify__(): Promise<void>;
160
    function __promisify__<T>(value: T): Promise<T>;
161
}
162
declare function clearImmediate(immediateId: NodeJS.Immediate): void;
163
164
declare function queueMicrotask(callback: () => void): void;
165
166
declare var require: NodeRequire;
167
declare var module: NodeModule;
168
169
// Same as module.exports
170
declare var exports: any;
171
172
// Buffer class
173
type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
174
175
/**
176
 * Raw data is stored in instances of the Buffer class.
177
 * 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.
178
 * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
179
 */
180
declare class Buffer extends Uint8Array {
181
    /**
182
     * Allocates a new buffer containing the given {str}.
183
     *
184
     * @param str String to store in buffer.
185
     * @param encoding encoding to use, optional.  Default is 'utf8'
186
     * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
187
     */
188
    constructor(str: string, encoding?: BufferEncoding);
189
    /**
190
     * Allocates a new buffer of {size} octets.
191
     *
192
     * @param size count of octets to allocate.
193
     * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
194
     */
195
    constructor(size: number);
196
    /**
197
     * Allocates a new buffer containing the given {array} of octets.
198
     *
199
     * @param array The octets to store.
200
     * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
201
     */
202
    constructor(array: Uint8Array);
203
    /**
204
     * Produces a Buffer backed by the same allocated memory as
205
     * the given {ArrayBuffer}/{SharedArrayBuffer}.
206
     *
207
     *
208
     * @param arrayBuffer The ArrayBuffer with which to share memory.
209
     * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
210
     */
211
    constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer);
212
    /**
213
     * Allocates a new buffer containing the given {array} of octets.
214
     *
215
     * @param array The octets to store.
216
     * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
217
     */
218
    constructor(array: any[]);
219
    /**
220
     * Copies the passed {buffer} data onto a new {Buffer} instance.
221
     *
222
     * @param buffer The buffer to copy.
223
     * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
224
     */
225
    constructor(buffer: Buffer);
226
    /**
227
     * When passed a reference to the .buffer property of a TypedArray instance,
228
     * the newly created Buffer will share the same allocated memory as the TypedArray.
229
     * The optional {byteOffset} and {length} arguments specify a memory range
230
     * within the {arrayBuffer} that will be shared by the Buffer.
231
     *
232
     * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer()
233
     */
234
    static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;
235
    /**
236
     * Creates a new Buffer using the passed {data}
237
     * @param data data to create a new Buffer
238
     */
239
    static from(data: number[]): Buffer;
240
    static from(data: Uint8Array): Buffer;
241
    /**
242
     * Creates a new buffer containing the coerced value of an object
243
     * A `TypeError` will be thrown if {obj} has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants.
244
     * @param obj An object supporting `Symbol.toPrimitive` or `valueOf()`.
245
     */
246
    static from(obj: { valueOf(): string | object } | { [Symbol.toPrimitive](hint: 'string'): string }, byteOffset?: number, length?: number): Buffer;
247
    /**
248
     * Creates a new Buffer containing the given JavaScript string {str}.
249
     * If provided, the {encoding} parameter identifies the character encoding.
250
     * If not provided, {encoding} defaults to 'utf8'.
251
     */
252
    static from(str: string, encoding?: BufferEncoding): Buffer;
253
    /**
254
     * Creates a new Buffer using the passed {data}
255
     * @param values to create a new Buffer
256
     */
257
    static of(...items: number[]): Buffer;
258
    /**
259
     * Returns true if {obj} is a Buffer
260
     *
261
     * @param obj object to test.
262
     */
263
    static isBuffer(obj: any): obj is Buffer;
264
    /**
265
     * Returns true if {encoding} is a valid encoding argument.
266
     * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
267
     *
268
     * @param encoding string to test.
269
     */
270
    static isEncoding(encoding: string): encoding is BufferEncoding;
271
    /**
272
     * Gives the actual byte length of a string. encoding defaults to 'utf8'.
273
     * This is not the same as String.prototype.length since that returns the number of characters in a string.
274
     *
275
     * @param string string to test.
276
     * @param encoding encoding used to evaluate (defaults to 'utf8')
277
     */
278
    static byteLength(
279
        string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
280
        encoding?: BufferEncoding
281
    ): number;
282
    /**
283
     * Returns a buffer which is the result of concatenating all the buffers in the list together.
284
     *
285
     * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
286
     * If the list has exactly one item, then the first item of the list is returned.
287
     * If the list has more than one item, then a new Buffer is created.
288
     *
289
     * @param list An array of Buffer objects to concatenate
290
     * @param totalLength Total length of the buffers when concatenated.
291
     *   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.
292
     */
293
    static concat(list: Uint8Array[], totalLength?: number): Buffer;
294
    /**
295
     * The same as buf1.compare(buf2).
296
     */
297
    static compare(buf1: Uint8Array, buf2: Uint8Array): number;
298
    /**
299
     * Allocates a new buffer of {size} octets.
300
     *
301
     * @param size count of octets to allocate.
302
     * @param fill if specified, buffer will be initialized by calling buf.fill(fill).
303
     *    If parameter is omitted, buffer will be filled with zeros.
304
     * @param encoding encoding used for call to buf.fill while initalizing
305
     */
306
    static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
307
    /**
308
     * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
309
     * of the newly created Buffer are unknown and may contain sensitive data.
310
     *
311
     * @param size count of octets to allocate
312
     */
313
    static allocUnsafe(size: number): Buffer;
314
    /**
315
     * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
316
     * of the newly created Buffer are unknown and may contain sensitive data.
317
     *
318
     * @param size count of octets to allocate
319
     */
320
    static allocUnsafeSlow(size: number): Buffer;
321
    /**
322
     * 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.
323
     */
324
    static poolSize: number;
325
326
    write(string: string, encoding?: BufferEncoding): number;
327
    write(string: string, offset: number, encoding?: BufferEncoding): number;
328
    write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
329
    toString(encoding?: BufferEncoding, start?: number, end?: number): string;
330
    toJSON(): { type: 'Buffer'; data: number[] };
331
    equals(otherBuffer: Uint8Array): boolean;
332
    compare(
333
        otherBuffer: Uint8Array,
334
        targetStart?: number,
335
        targetEnd?: number,
336
        sourceStart?: number,
337
        sourceEnd?: number
338
    ): number;
339
    copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
340
    /**
341
     * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
342
     *
343
     * This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory.
344
     *
345
     * @param begin Where the new `Buffer` will start. Default: `0`.
346
     * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
347
     */
348
    slice(begin?: number, end?: number): Buffer;
349
    /**
350
     * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
351
     *
352
     * This method is compatible with `Uint8Array#subarray()`.
353
     *
354
     * @param begin Where the new `Buffer` will start. Default: `0`.
355
     * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
356
     */
357
    subarray(begin?: number, end?: number): Buffer;
358
    writeUIntLE(value: number, offset: number, byteLength: number): number;
359
    writeUIntBE(value: number, offset: number, byteLength: number): number;
360
    writeIntLE(value: number, offset: number, byteLength: number): number;
361
    writeIntBE(value: number, offset: number, byteLength: number): number;
362
    readUIntLE(offset: number, byteLength: number): number;
363
    readUIntBE(offset: number, byteLength: number): number;
364
    readIntLE(offset: number, byteLength: number): number;
365
    readIntBE(offset: number, byteLength: number): number;
366
    readUInt8(offset?: number): number;
367
    readUInt16LE(offset?: number): number;
368
    readUInt16BE(offset?: number): number;
369
    readUInt32LE(offset?: number): number;
370
    readUInt32BE(offset?: number): number;
371
    readInt8(offset?: number): number;
372
    readInt16LE(offset?: number): number;
373
    readInt16BE(offset?: number): number;
374
    readInt32LE(offset?: number): number;
375
    readInt32BE(offset?: number): number;
376
    readFloatLE(offset?: number): number;
377
    readFloatBE(offset?: number): number;
378
    readDoubleLE(offset?: number): number;
379
    readDoubleBE(offset?: number): number;
380
    reverse(): this;
381
    swap16(): Buffer;
382
    swap32(): Buffer;
383
    swap64(): Buffer;
384
    writeUInt8(value: number, offset?: number): number;
385
    writeUInt16LE(value: number, offset?: number): number;
386
    writeUInt16BE(value: number, offset?: number): number;
387
    writeUInt32LE(value: number, offset?: number): number;
388
    writeUInt32BE(value: number, offset?: number): number;
389
    writeInt8(value: number, offset?: number): number;
390
    writeInt16LE(value: number, offset?: number): number;
391
    writeInt16BE(value: number, offset?: number): number;
392
    writeInt32LE(value: number, offset?: number): number;
393
    writeInt32BE(value: number, offset?: number): number;
394
    writeFloatLE(value: number, offset?: number): number;
395
    writeFloatBE(value: number, offset?: number): number;
396
    writeDoubleLE(value: number, offset?: number): number;
397
    writeDoubleBE(value: number, offset?: number): number;
398
399
    fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
400
401
    indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
402
    lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
403
    entries(): IterableIterator<[number, number]>;
404
    includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
405
    keys(): IterableIterator<number>;
406
    values(): IterableIterator<number>;
407
}
408
409
/*----------------------------------------------*
410
*                                               *
411
*               GLOBAL INTERFACES               *
412
*                                               *
413
*-----------------------------------------------*/
414
declare namespace NodeJS {
415
    interface InspectOptions {
416
        /**
417
         * If set to `true`, getters are going to be
418
         * inspected as well. If set to `'get'` only getters without setter are going
419
         * to be inspected. If set to `'set'` only getters having a corresponding
420
         * setter are going to be inspected. This might cause side effects depending on
421
         * the getter function.
422
         * @default `false`
423
         */
424
        getters?: 'get' | 'set' | boolean;
425
        showHidden?: boolean;
426
        /**
427
         * @default 2
428
         */
429
        depth?: number | null;
430
        colors?: boolean;
431
        customInspect?: boolean;
432
        showProxy?: boolean;
433
        maxArrayLength?: number | null;
434
        /**
435
         * Specifies the maximum number of characters to
436
         * include when formatting. Set to `null` or `Infinity` to show all elements.
437
         * Set to `0` or negative to show no characters.
438
         * @default Infinity
439
         */
440
        maxStringLength?: number | null;
441
        breakLength?: number;
442
        /**
443
         * Setting this to `false` causes each object key
444
         * to be displayed on a new line. It will also add new lines to text that is
445
         * longer than `breakLength`. If set to a number, the most `n` inner elements
446
         * are united on a single line as long as all properties fit into
447
         * `breakLength`. Short array elements are also grouped together. Note that no
448
         * text will be reduced below 16 characters, no matter the `breakLength` size.
449
         * For more information, see the example below.
450
         * @default `true`
451
         */
452
        compact?: boolean | number;
453
        sorted?: boolean | ((a: string, b: string) => number);
454
    }
455
456
    interface ConsoleConstructorOptions {
457
        stdout: WritableStream;
458
        stderr?: WritableStream;
459
        ignoreErrors?: boolean;
460
        colorMode?: boolean | 'auto';
461
        inspectOptions?: InspectOptions;
462
    }
463
464
    interface ConsoleConstructor {
465
        prototype: Console;
466
        new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console;
467
        new(options: ConsoleConstructorOptions): Console;
468
    }
469
470
    interface CallSite {
471
        /**
472
         * Value of "this"
473
         */
474
        getThis(): any;
475
476
        /**
477
         * Type of "this" as a string.
478
         * This is the name of the function stored in the constructor field of
479
         * "this", if available.  Otherwise the object's [[Class]] internal
480
         * property.
481
         */
482
        getTypeName(): string | null;
483
484
        /**
485
         * Current function
486
         */
487
        getFunction(): Function | undefined;
488
489
        /**
490
         * Name of the current function, typically its name property.
491
         * If a name property is not available an attempt will be made to try
492
         * to infer a name from the function's context.
493
         */
494
        getFunctionName(): string | null;
495
496
        /**
497
         * Name of the property [of "this" or one of its prototypes] that holds
498
         * the current function
499
         */
500
        getMethodName(): string | null;
501
502
        /**
503
         * Name of the script [if this function was defined in a script]
504
         */
505
        getFileName(): string | null;
506
507
        /**
508
         * Current line number [if this function was defined in a script]
509
         */
510
        getLineNumber(): number | null;
511
512
        /**
513
         * Current column number [if this function was defined in a script]
514
         */
515
        getColumnNumber(): number | null;
516
517
        /**
518
         * A call site object representing the location where eval was called
519
         * [if this function was created using a call to eval]
520
         */
521
        getEvalOrigin(): string | undefined;
522
523
        /**
524
         * Is this a toplevel invocation, that is, is "this" the global object?
525
         */
526
        isToplevel(): boolean;
527
528
        /**
529
         * Does this call take place in code defined by a call to eval?
530
         */
531
        isEval(): boolean;
532
533
        /**
534
         * Is this call in native V8 code?
535
         */
536
        isNative(): boolean;
537
538
        /**
539
         * Is this a constructor call?
540
         */
541
        isConstructor(): boolean;
542
    }
543
544
    interface ErrnoException extends Error {
545
        errno?: number;
546
        code?: string;
547
        path?: string;
548
        syscall?: string;
549
        stack?: string;
550
    }
551
552
    interface EventEmitter {
553
        addListener(event: string | symbol, listener: (...args: any[]) => void): this;
554
        on(event: string | symbol, listener: (...args: any[]) => void): this;
555
        once(event: string | symbol, listener: (...args: any[]) => void): this;
556
        removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
557
        off(event: string | symbol, listener: (...args: any[]) => void): this;
558
        removeAllListeners(event?: string | symbol): this;
559
        setMaxListeners(n: number): this;
560
        getMaxListeners(): number;
561
        listeners(event: string | symbol): Function[];
562
        rawListeners(event: string | symbol): Function[];
563
        emit(event: string | symbol, ...args: any[]): boolean;
564
        listenerCount(type: string | symbol): number;
565
        // Added in Node 6...
566
        prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
567
        prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
568
        eventNames(): Array<string | symbol>;
569
    }
570
571
    interface ReadableStream extends EventEmitter {
572
        readable: boolean;
573
        read(size?: number): string | Buffer;
574
        setEncoding(encoding: BufferEncoding): this;
575
        pause(): this;
576
        resume(): this;
577
        isPaused(): boolean;
578
        pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
579
        unpipe(destination?: WritableStream): this;
580
        unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
581
        wrap(oldStream: ReadableStream): this;
582
        [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
583
    }
584
585
    interface WritableStream extends EventEmitter {
586
        writable: boolean;
587
        write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
588
        write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
589
        end(cb?: () => void): void;
590
        end(data: string | Uint8Array, cb?: () => void): void;
591
        end(str: string, encoding?: BufferEncoding, cb?: () => void): void;
592
    }
593
594
    interface ReadWriteStream extends ReadableStream, WritableStream { }
595
596
    interface Domain extends EventEmitter {
597
        run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
598
        add(emitter: EventEmitter | Timer): void;
599
        remove(emitter: EventEmitter | Timer): void;
600
        bind<T extends Function>(cb: T): T;
601
        intercept<T extends Function>(cb: T): T;
602
603
        addListener(event: string, listener: (...args: any[]) => void): this;
604
        on(event: string, listener: (...args: any[]) => void): this;
605
        once(event: string, listener: (...args: any[]) => void): this;
606
        removeListener(event: string, listener: (...args: any[]) => void): this;
607
        removeAllListeners(event?: string): this;
608
    }
609
610
    interface MemoryUsage {
611
        rss: number;
612
        heapTotal: number;
613
        heapUsed: number;
614
        external: number;
615
        arrayBuffers: number;
616
    }
617
618
    interface CpuUsage {
619
        user: number;
620
        system: number;
621
    }
622
623
    interface ProcessRelease {
624
        name: string;
625
        sourceUrl?: string;
626
        headersUrl?: string;
627
        libUrl?: string;
628
        lts?: string;
629
    }
630
631
    interface ProcessVersions {
632
        http_parser: string;
633
        node: string;
634
        v8: string;
635
        ares: string;
636
        uv: string;
637
        zlib: string;
638
        modules: string;
639
        openssl: string;
640
    }
641
642
    type Platform = 'aix'
643
        | 'android'
644
        | 'darwin'
645
        | 'freebsd'
646
        | 'linux'
647
        | 'openbsd'
648
        | 'sunos'
649
        | 'win32'
650
        | 'cygwin'
651
        | 'netbsd';
652
653
    type Signals =
654
        "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" |
655
        "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" |
656
        "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" |
657
        "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
658
659
    type MultipleResolveType = 'resolve' | 'reject';
660
661
    type BeforeExitListener = (code: number) => void;
662
    type DisconnectListener = () => void;
663
    type ExitListener = (code: number) => void;
664
    type RejectionHandledListener = (promise: Promise<any>) => void;
665
    type UncaughtExceptionListener = (error: Error) => void;
666
    type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<any>) => void;
667
    type WarningListener = (warning: Error) => void;
668
    type MessageListener = (message: any, sendHandle: any) => void;
669
    type SignalsListener = (signal: Signals) => void;
670
    type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
671
    type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
672
    type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<any>, value: any) => void;
673
674
    interface Socket extends ReadWriteStream {
675
        isTTY?: true;
676
    }
677
678
    // Alias for compatibility
679
    interface ProcessEnv extends Dict<string> {}
680
681
    interface HRTime {
682
        (time?: [number, number]): [number, number];
683
    }
684
685
    interface ProcessReport {
686
        /**
687
         * Directory where the report is written.
688
         * working directory of the Node.js process.
689
         * @default '' indicating that reports are written to the current
690
         */
691
        directory: string;
692
693
        /**
694
         * Filename where the report is written.
695
         * The default value is the empty string.
696
         * @default '' the output filename will be comprised of a timestamp,
697
         * PID, and sequence number.
698
         */
699
        filename: string;
700
701
        /**
702
         * Returns a JSON-formatted diagnostic report for the running process.
703
         * The report's JavaScript stack trace is taken from err, if present.
704
         */
705
        getReport(err?: Error): string;
706
707
        /**
708
         * If true, a diagnostic report is generated on fatal errors,
709
         * such as out of memory errors or failed C++ assertions.
710
         * @default false
711
         */
712
        reportOnFatalError: boolean;
713
714
        /**
715
         * If true, a diagnostic report is generated when the process
716
         * receives the signal specified by process.report.signal.
717
         * @defaul false
718
         */
719
        reportOnSignal: boolean;
720
721
        /**
722
         * If true, a diagnostic report is generated on uncaught exception.
723
         * @default false
724
         */
725
        reportOnUncaughtException: boolean;
726
727
        /**
728
         * The signal used to trigger the creation of a diagnostic report.
729
         * @default 'SIGUSR2'
730
         */
731
        signal: Signals;
732
733
        /**
734
         * Writes a diagnostic report to a file. If filename is not provided, the default filename
735
         * includes the date, time, PID, and a sequence number.
736
         * The report's JavaScript stack trace is taken from err, if present.
737
         *
738
         * @param fileName Name of the file where the report is written.
739
         * This should be a relative path, that will be appended to the directory specified in
740
         * `process.report.directory`, or the current working directory of the Node.js process,
741
         * if unspecified.
742
         * @param error A custom error used for reporting the JavaScript stack.
743
         * @return Filename of the generated report.
744
         */
745
        writeReport(fileName?: string): string;
746
        writeReport(error?: Error): string;
747
        writeReport(fileName?: string, err?: Error): string;
748
    }
749
750
    interface ResourceUsage {
751
        fsRead: number;
752
        fsWrite: number;
753
        involuntaryContextSwitches: number;
754
        ipcReceived: number;
755
        ipcSent: number;
756
        majorPageFault: number;
757
        maxRSS: number;
758
        minorPageFault: number;
759
        sharedMemorySize: number;
760
        signalsCount: number;
761
        swappedOut: number;
762
        systemCPUTime: number;
763
        unsharedDataSize: number;
764
        unsharedStackSize: number;
765
        userCPUTime: number;
766
        voluntaryContextSwitches: number;
767
    }
768
769
    interface Process extends EventEmitter {
770
        /**
771
         * Can also be a tty.WriteStream, not typed due to limitations.
772
         */
773
        stdout: WriteStream;
774
        /**
775
         * Can also be a tty.WriteStream, not typed due to limitations.
776
         */
777
        stderr: WriteStream;
778
        stdin: ReadStream;
779
        openStdin(): Socket;
780
        argv: string[];
781
        argv0: string;
782
        execArgv: string[];
783
        execPath: string;
784
        abort(): void;
785
        chdir(directory: string): void;
786
        cwd(): string;
787
        debugPort: number;
788
        emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
789
        env: ProcessEnv;
790
        exit(code?: number): never;
791
        exitCode?: number;
792
        getgid(): number;
793
        setgid(id: number | string): void;
794
        getuid(): number;
795
        setuid(id: number | string): void;
796
        geteuid(): number;
797
        seteuid(id: number | string): void;
798
        getegid(): number;
799
        setegid(id: number | string): void;
800
        getgroups(): number[];
801
        setgroups(groups: Array<string | number>): void;
802
        setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
803
        hasUncaughtExceptionCaptureCallback(): boolean;
804
        version: string;
805
        versions: ProcessVersions;
806
        config: {
807
            target_defaults: {
808
                cflags: any[];
809
                default_configuration: string;
810
                defines: string[];
811
                include_dirs: string[];
812
                libraries: string[];
813
            };
814
            variables: {
815
                clang: number;
816
                host_arch: string;
817
                node_install_npm: boolean;
818
                node_install_waf: boolean;
819
                node_prefix: string;
820
                node_shared_openssl: boolean;
821
                node_shared_v8: boolean;
822
                node_shared_zlib: boolean;
823
                node_use_dtrace: boolean;
824
                node_use_etw: boolean;
825
                node_use_openssl: boolean;
826
                target_arch: string;
827
                v8_no_strict_aliasing: number;
828
                v8_use_snapshot: boolean;
829
                visibility: string;
830
            };
831
        };
832
        kill(pid: number, signal?: string | number): true;
833
        pid: number;
834
        ppid: number;
835
        title: string;
836
        arch: string;
837
        platform: Platform;
838
        memoryUsage(): MemoryUsage;
839
        cpuUsage(previousValue?: CpuUsage): CpuUsage;
840
        nextTick(callback: Function, ...args: any[]): void;
841
        release: ProcessRelease;
842
        features: {
843
            inspector: boolean;
844
            debug: boolean;
845
            uv: boolean;
846
            ipv6: boolean;
847
            tls_alpn: boolean;
848
            tls_sni: boolean;
849
            tls_ocsp: boolean;
850
            tls: boolean;
851
        };
852
        /**
853
         * Can only be set if not in worker thread.
854
         */
855
        umask(mask: number): number;
856
        uptime(): number;
857
        hrtime: HRTime;
858
        domain: Domain;
859
860
        // Worker
861
        send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean;
862
        disconnect(): void;
863
        connected: boolean;
864
865
        /**
866
         * The `process.allowedNodeEnvironmentFlags` property is a special,
867
         * read-only `Set` of flags allowable within the [`NODE_OPTIONS`][]
868
         * environment variable.
869
         */
870
        allowedNodeEnvironmentFlags: ReadonlySet<string>;
871
872
        /**
873
         * Only available with `--experimental-report`
874
         */
875
        report?: ProcessReport;
876
877
        resourceUsage(): ResourceUsage;
878
879
        /* EventEmitter */
880
        addListener(event: "beforeExit", listener: BeforeExitListener): this;
881
        addListener(event: "disconnect", listener: DisconnectListener): this;
882
        addListener(event: "exit", listener: ExitListener): this;
883
        addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
884
        addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
885
        addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
886
        addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
887
        addListener(event: "warning", listener: WarningListener): this;
888
        addListener(event: "message", listener: MessageListener): this;
889
        addListener(event: Signals, listener: SignalsListener): this;
890
        addListener(event: "newListener", listener: NewListenerListener): this;
891
        addListener(event: "removeListener", listener: RemoveListenerListener): this;
892
        addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
893
894
        emit(event: "beforeExit", code: number): boolean;
895
        emit(event: "disconnect"): boolean;
896
        emit(event: "exit", code: number): boolean;
897
        emit(event: "rejectionHandled", promise: Promise<any>): boolean;
898
        emit(event: "uncaughtException", error: Error): boolean;
899
        emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
900
        emit(event: "unhandledRejection", reason: any, promise: Promise<any>): boolean;
901
        emit(event: "warning", warning: Error): boolean;
902
        emit(event: "message", message: any, sendHandle: any): this;
903
        emit(event: Signals, signal: Signals): boolean;
904
        emit(event: "newListener", eventName: string | symbol, listener: (...args: any[]) => void): this;
905
        emit(event: "removeListener", eventName: string, listener: (...args: any[]) => void): this;
906
        emit(event: "multipleResolves", listener: MultipleResolveListener): this;
907
908
        on(event: "beforeExit", listener: BeforeExitListener): this;
909
        on(event: "disconnect", listener: DisconnectListener): this;
910
        on(event: "exit", listener: ExitListener): this;
911
        on(event: "rejectionHandled", listener: RejectionHandledListener): this;
912
        on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
913
        on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
914
        on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
915
        on(event: "warning", listener: WarningListener): this;
916
        on(event: "message", listener: MessageListener): this;
917
        on(event: Signals, listener: SignalsListener): this;
918
        on(event: "newListener", listener: NewListenerListener): this;
919
        on(event: "removeListener", listener: RemoveListenerListener): this;
920
        on(event: "multipleResolves", listener: MultipleResolveListener): this;
921
        on(event: string | symbol, listener: (...args: any[]) => void): this;
922
923
        once(event: "beforeExit", listener: BeforeExitListener): this;
924
        once(event: "disconnect", listener: DisconnectListener): this;
925
        once(event: "exit", listener: ExitListener): this;
926
        once(event: "rejectionHandled", listener: RejectionHandledListener): this;
927
        once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
928
        once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
929
        once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
930
        once(event: "warning", listener: WarningListener): this;
931
        once(event: "message", listener: MessageListener): this;
932
        once(event: Signals, listener: SignalsListener): this;
933
        once(event: "newListener", listener: NewListenerListener): this;
934
        once(event: "removeListener", listener: RemoveListenerListener): this;
935
        once(event: "multipleResolves", listener: MultipleResolveListener): this;
936
937
        prependListener(event: "beforeExit", listener: BeforeExitListener): this;
938
        prependListener(event: "disconnect", listener: DisconnectListener): this;
939
        prependListener(event: "exit", listener: ExitListener): this;
940
        prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
941
        prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
942
        prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
943
        prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
944
        prependListener(event: "warning", listener: WarningListener): this;
945
        prependListener(event: "message", listener: MessageListener): this;
946
        prependListener(event: Signals, listener: SignalsListener): this;
947
        prependListener(event: "newListener", listener: NewListenerListener): this;
948
        prependListener(event: "removeListener", listener: RemoveListenerListener): this;
949
        prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
950
951
        prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
952
        prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
953
        prependOnceListener(event: "exit", listener: ExitListener): this;
954
        prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
955
        prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
956
        prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
957
        prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
958
        prependOnceListener(event: "warning", listener: WarningListener): this;
959
        prependOnceListener(event: "message", listener: MessageListener): this;
960
        prependOnceListener(event: Signals, listener: SignalsListener): this;
961
        prependOnceListener(event: "newListener", listener: NewListenerListener): this;
962
        prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this;
963
        prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
964
965
        listeners(event: "beforeExit"): BeforeExitListener[];
966
        listeners(event: "disconnect"): DisconnectListener[];
967
        listeners(event: "exit"): ExitListener[];
968
        listeners(event: "rejectionHandled"): RejectionHandledListener[];
969
        listeners(event: "uncaughtException"): UncaughtExceptionListener[];
970
        listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[];
971
        listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
972
        listeners(event: "warning"): WarningListener[];
973
        listeners(event: "message"): MessageListener[];
974
        listeners(event: Signals): SignalsListener[];
975
        listeners(event: "newListener"): NewListenerListener[];
976
        listeners(event: "removeListener"): RemoveListenerListener[];
977
        listeners(event: "multipleResolves"): MultipleResolveListener[];
978
    }
979
980
    interface Global {
981
        Array: typeof Array;
982
        ArrayBuffer: typeof ArrayBuffer;
983
        Boolean: typeof Boolean;
984
        Buffer: typeof Buffer;
985
        DataView: typeof DataView;
986
        Date: typeof Date;
987
        Error: typeof Error;
988
        EvalError: typeof EvalError;
989
        Float32Array: typeof Float32Array;
990
        Float64Array: typeof Float64Array;
991
        Function: typeof Function;
992
        Infinity: typeof Infinity;
993
        Int16Array: typeof Int16Array;
994
        Int32Array: typeof Int32Array;
995
        Int8Array: typeof Int8Array;
996
        Intl: typeof Intl;
997
        JSON: typeof JSON;
998
        Map: MapConstructor;
999
        Math: typeof Math;
1000
        NaN: typeof NaN;
1001
        Number: typeof Number;
1002
        Object: typeof Object;
1003
        Promise: typeof Promise;
1004
        RangeError: typeof RangeError;
1005
        ReferenceError: typeof ReferenceError;
1006
        RegExp: typeof RegExp;
1007
        Set: SetConstructor;
1008
        String: typeof String;
1009
        Symbol: Function;
1010
        SyntaxError: typeof SyntaxError;
1011
        TypeError: typeof TypeError;
1012
        URIError: typeof URIError;
1013
        Uint16Array: typeof Uint16Array;
1014
        Uint32Array: typeof Uint32Array;
1015
        Uint8Array: typeof Uint8Array;
1016
        Uint8ClampedArray: typeof Uint8ClampedArray;
1017
        WeakMap: WeakMapConstructor;
1018
        WeakSet: WeakSetConstructor;
1019
        clearImmediate: (immediateId: Immediate) => void;
1020
        clearInterval: (intervalId: Timeout) => void;
1021
        clearTimeout: (timeoutId: Timeout) => void;
1022
        console: typeof console;
1023
        decodeURI: typeof decodeURI;
1024
        decodeURIComponent: typeof decodeURIComponent;
1025
        encodeURI: typeof encodeURI;
1026
        encodeURIComponent: typeof encodeURIComponent;
1027
        escape: (str: string) => string;
1028
        eval: typeof eval;
1029
        global: Global;
1030
        isFinite: typeof isFinite;
1031
        isNaN: typeof isNaN;
1032
        parseFloat: typeof parseFloat;
1033
        parseInt: typeof parseInt;
1034
        process: Process;
1035
        setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => Immediate;
1036
        setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;
1037
        setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;
1038
        queueMicrotask: typeof queueMicrotask;
1039
        undefined: typeof undefined;
1040
        unescape: (str: string) => string;
1041
        gc: () => void;
1042
        v8debug?: any;
1043
    }
1044
1045
    interface RefCounted {
1046
        ref(): this;
1047
        unref(): this;
1048
    }
1049
1050
    // compatibility with older typings
1051
    interface Timer extends RefCounted {
1052
        hasRef(): boolean;
1053
        refresh(): this;
1054
    }
1055
1056
    interface Immediate extends RefCounted {
1057
        hasRef(): boolean;
1058
        _onImmediate: Function; // to distinguish it from the Timeout class
1059
    }
1060
1061
    interface Timeout extends Timer {
1062
        hasRef(): boolean;
1063
        refresh(): this;
1064
    }
1065
1066
    type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
1067
    type ArrayBufferView = TypedArray | DataView;
1068
1069
    interface Require {
1070
        /* tslint:disable-next-line:callable-types */
1071
        (id: string): any;
1072
        resolve: RequireResolve;
1073
        cache: Dict<NodeModule>;
1074
        /**
1075
         * @deprecated
1076
         */
1077
        extensions: RequireExtensions;
1078
        main: Module | undefined;
1079
    }
1080
1081
    interface RequireResolve {
1082
        (id: string, options?: { paths?: string[]; }): string;
1083
        paths(request: string): string[] | null;
1084
    }
1085
1086
    interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
1087
        '.js': (m: Module, filename: string) => any;
1088
        '.json': (m: Module, filename: string) => any;
1089
        '.node': (m: Module, filename: string) => any;
1090
    }
1091
    interface Module {
1092
        exports: any;
1093
        require: Require;
1094
        id: string;
1095
        filename: string;
1096
        loaded: boolean;
1097
        parent: Module | null;
1098
        children: Module[];
1099
        paths: string[];
1100
    }
1101
1102
    interface Dict<T> {
1103
        [key: string]: T | undefined;
1104
    }
1105
1106
    interface ReadOnlyDict<T> {
1107
        readonly [key: string]: T | undefined;
1108
    }
1109
}
1110