UNPKG

52.6 kBTypeScriptView Raw
1// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
2interface 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?: ReadonlyArray<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 * The console.markTimeline() method is the deprecated form of console.timeStamp().
91 *
92 * @deprecated Use console.timeStamp() instead.
93 */
94 markTimeline(label?: string): void;
95 /**
96 * This method does not display anything unless used in the inspector.
97 * Starts a JavaScript CPU profile with an optional label.
98 */
99 profile(label?: string): void;
100 /**
101 * This method does not display anything unless used in the inspector.
102 * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
103 */
104 profileEnd(label?: string): void;
105 /**
106 * This method does not display anything unless used in the inspector.
107 * Adds an event with the label `label` to the Timeline panel of the inspector.
108 */
109 timeStamp(label?: string): void;
110 /**
111 * This method does not display anything unless used in the inspector.
112 * The console.timeline() method is the deprecated form of console.time().
113 *
114 * @deprecated Use console.time() instead.
115 */
116 timeline(label?: string): void;
117 /**
118 * This method does not display anything unless used in the inspector.
119 * The console.timelineEnd() method is the deprecated form of console.timeEnd().
120 *
121 * @deprecated Use console.timeEnd() instead.
122 */
123 timelineEnd(label?: string): void;
124}
125
126interface Error {
127 stack?: string | undefined;
128}
129
130// Declare "static" methods in Error
131interface ErrorConstructor {
132 /** Create .stack property on a target object */
133 captureStackTrace(targetObject: Object, constructorOpt?: Function): void;
134
135 /**
136 * Optional override for formatting stack traces
137 *
138 * @see https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces
139 */
140 prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
141
142 stackTraceLimit: number;
143}
144
145interface SymbolConstructor {
146 readonly observable: symbol;
147}
148
149// Node.js ESNEXT support
150interface String {
151 /** Removes whitespace from the left end of a string. */
152 trimLeft(): string;
153 /** Removes whitespace from the right end of a string. */
154 trimRight(): string;
155
156 /** Returns a copy with leading whitespace removed. */
157 trimStart(): string;
158 /** Returns a copy with trailing whitespace removed. */
159 trimEnd(): string;
160}
161
162interface ImportMeta {
163 url: string;
164}
165
166/*-----------------------------------------------*
167 * *
168 * GLOBAL *
169 * *
170 ------------------------------------------------*/
171declare var process: NodeJS.Process;
172declare var console: Console;
173
174declare var __filename: string;
175declare var __dirname: string;
176
177declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
178declare namespace setTimeout {
179 function __promisify__(ms: number): Promise<void>;
180 function __promisify__<T>(ms: number, value: T): Promise<T>;
181}
182declare function clearTimeout(timeoutId: NodeJS.Timeout): void;
183declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
184declare function clearInterval(intervalId: NodeJS.Timeout): void;
185declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate;
186declare namespace setImmediate {
187 function __promisify__(): Promise<void>;
188 function __promisify__<T>(value: T): Promise<T>;
189}
190declare function clearImmediate(immediateId: NodeJS.Immediate): void;
191
192declare function queueMicrotask(callback: () => void): void;
193
194// TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version.
195interface NodeRequireFunction {
196 (id: string): any;
197}
198
199interface NodeRequireCache {
200 [path: string]: NodeModule;
201}
202
203interface NodeRequire extends NodeRequireFunction {
204 resolve: RequireResolve;
205 cache: NodeRequireCache;
206 /**
207 * @deprecated
208 */
209 extensions: NodeExtensions;
210 main: NodeModule | undefined;
211}
212
213interface RequireResolve {
214 (id: string, options?: { paths?: string[] | undefined; }): string;
215 paths(request: string): string[] | null;
216}
217
218interface NodeExtensions {
219 '.js': (m: NodeModule, filename: string) => any;
220 '.json': (m: NodeModule, filename: string) => any;
221 '.node': (m: NodeModule, filename: string) => any;
222 [ext: string]: (m: NodeModule, filename: string) => any;
223}
224
225declare var require: NodeRequire;
226
227interface NodeModule {
228 exports: any;
229 require: NodeRequireFunction;
230 id: string;
231 filename: string;
232 loaded: boolean;
233 /** @deprecated since 12.19.0 Please use `require.main` and `module.children` instead. */
234 parent: NodeModule | null | undefined;
235 children: NodeModule[];
236 /**
237 * @since 11.14.0
238 *
239 * The directory name of the module. This is usually the same as the path.dirname() of the module.id.
240 */
241 path: string;
242 paths: string[];
243}
244
245declare var module: NodeModule;
246
247// Same as module.exports
248declare var exports: any;
249
250// Buffer class
251type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
252
253interface Buffer {
254 constructor: typeof Buffer;
255 readBigUInt64BE(offset?: number): bigint;
256 /**
257 * @alias Buffer.readBigUInt64BE
258 * @since v12.19.0
259 */
260 readBigUint64BE(offset?: number): bigint;
261 readBigUInt64LE(offset?: number): bigint;
262 /**
263 * @alias Buffer.readBigUInt64LE
264 * @since v12.19.0
265 */
266 readBigUint64LE(offset?: number): bigint;
267 readBigInt64BE(offset?: number): bigint;
268 readBigInt64LE(offset?: number): bigint;
269 writeBigInt64BE(value: bigint, offset?: number): number;
270 writeBigInt64LE(value: bigint, offset?: number): number;
271 writeBigUInt64BE(value: bigint, offset?: number): number;
272 /**
273 * @alias Buffer.writeBigUInt64BE
274 * @since v12.19.0
275 */
276 writeBigUint64BE(value: bigint, offset?: number): number;
277 writeBigUInt64LE(value: bigint, offset?: number): number;
278 /**
279 * @alias Buffer.writeBigUInt64LE
280 * @since v12.19.0
281 */
282 writeBigUint64LE(value: bigint, offset?: number): number;
283}
284
285/**
286 * Raw data is stored in instances of the Buffer class.
287 * 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.
288 * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
289 */
290declare class Buffer extends Uint8Array {
291 /**
292 * Allocates a new buffer containing the given {str}.
293 *
294 * @param str String to store in buffer.
295 * @param encoding encoding to use, optional. Default is 'utf8'
296 * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
297 */
298 constructor(str: string, encoding?: BufferEncoding);
299 /**
300 * Allocates a new buffer of {size} octets.
301 *
302 * @param size count of octets to allocate.
303 * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
304 */
305 constructor(size: number);
306 /**
307 * Allocates a new buffer containing the given {array} of octets.
308 *
309 * @param array The octets to store.
310 * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
311 */
312 constructor(array: Uint8Array);
313 /**
314 * Produces a Buffer backed by the same allocated memory as
315 * the given {ArrayBuffer}/{SharedArrayBuffer}.
316 *
317 *
318 * @param arrayBuffer The ArrayBuffer with which to share memory.
319 * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
320 */
321 constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer);
322 /**
323 * Allocates a new buffer containing the given {array} of octets.
324 *
325 * @param array The octets to store.
326 * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
327 */
328 constructor(array: ReadonlyArray<any>);
329 /**
330 * Copies the passed {buffer} data onto a new {Buffer} instance.
331 *
332 * @param buffer The buffer to copy.
333 * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
334 */
335 constructor(buffer: Buffer);
336 /**
337 * When passed a reference to the .buffer property of a TypedArray instance,
338 * the newly created Buffer will share the same allocated memory as the TypedArray.
339 * The optional {byteOffset} and {length} arguments specify a memory range
340 * within the {arrayBuffer} that will be shared by the Buffer.
341 *
342 * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer()
343 */
344 static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;
345 /**
346 * Creates a new Buffer using the passed {data}
347 * @param data data to create a new Buffer
348 */
349 static from(data: ReadonlyArray<number>): Buffer;
350 static from(data: Uint8Array): Buffer;
351 /**
352 * Creates a new buffer containing the coerced value of an object
353 * A `TypeError` will be thrown if {obj} has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants.
354 * @param obj An object supporting `Symbol.toPrimitive` or `valueOf()`.
355 */
356 static from(obj: { valueOf(): string | object } | { [Symbol.toPrimitive](hint: 'string'): string }, byteOffset?: number, length?: number): Buffer;
357 /**
358 * Creates a new Buffer containing the given JavaScript string {str}.
359 * If provided, the {encoding} parameter identifies the character encoding.
360 * If not provided, {encoding} defaults to 'utf8'.
361 */
362 static from(str: string, encoding?: BufferEncoding): Buffer;
363 /**
364 * Creates a new Buffer using the passed {data}
365 * @param values to create a new Buffer
366 */
367 static of(...items: number[]): Buffer;
368 /**
369 * Returns true if {obj} is a Buffer
370 *
371 * @param obj object to test.
372 */
373 static isBuffer(obj: any): obj is Buffer;
374 /**
375 * Returns true if {encoding} is a valid encoding argument.
376 * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
377 *
378 * @param encoding string to test.
379 */
380 static isEncoding(encoding: string): encoding is BufferEncoding;
381 /**
382 * Gives the actual byte length of a string. encoding defaults to 'utf8'.
383 * This is not the same as String.prototype.length since that returns the number of characters in a string.
384 *
385 * @param string string to test.
386 * @param encoding encoding used to evaluate (defaults to 'utf8')
387 */
388 static byteLength(
389 string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
390 encoding?: BufferEncoding
391 ): number;
392 /**
393 * Returns a buffer which is the result of concatenating all the buffers in the list together.
394 *
395 * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
396 * If the list has exactly one item, then the first item of the list is returned.
397 * If the list has more than one item, then a new Buffer is created.
398 *
399 * @param list An array of Buffer objects to concatenate
400 * @param totalLength Total length of the buffers when concatenated.
401 * 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.
402 */
403 static concat(list: ReadonlyArray<Uint8Array>, totalLength?: number): Buffer;
404 /**
405 * The same as buf1.compare(buf2).
406 */
407 static compare(buf1: Uint8Array, buf2: Uint8Array): number;
408 /**
409 * Allocates a new buffer of {size} octets.
410 *
411 * @param size count of octets to allocate.
412 * @param fill if specified, buffer will be initialized by calling buf.fill(fill).
413 * If parameter is omitted, buffer will be filled with zeros.
414 * @param encoding encoding used for call to buf.fill while initalizing
415 */
416 static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
417 /**
418 * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
419 * of the newly created Buffer are unknown and may contain sensitive data.
420 *
421 * @param size count of octets to allocate
422 */
423 static allocUnsafe(size: number): Buffer;
424 /**
425 * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
426 * of the newly created Buffer are unknown and may contain sensitive data.
427 *
428 * @param size count of octets to allocate
429 */
430 static allocUnsafeSlow(size: number): Buffer;
431 /**
432 * 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.
433 */
434 static poolSize: number;
435
436 write(string: string, encoding?: BufferEncoding): number;
437 write(string: string, offset: number, encoding?: BufferEncoding): number;
438 write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
439 toString(encoding?: string, start?: number, end?: number): string;
440 toJSON(): { type: 'Buffer'; data: number[] };
441 equals(otherBuffer: Uint8Array): boolean;
442 compare(
443 otherBuffer: Uint8Array,
444 targetStart?: number,
445 targetEnd?: number,
446 sourceStart?: number,
447 sourceEnd?: number
448 ): number;
449 copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
450 /**
451 * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
452 *
453 * This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory.
454 *
455 * @param begin Where the new `Buffer` will start. Default: `0`.
456 * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
457 */
458 slice(begin?: number, end?: number): Buffer;
459 /**
460 * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
461 *
462 * This method is compatible with `Uint8Array#subarray()`.
463 *
464 * @param begin Where the new `Buffer` will start. Default: `0`.
465 * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
466 */
467 subarray(begin?: number, end?: number): Buffer;
468 writeUIntLE(value: number, offset: number, byteLength: number): number;
469 /**
470 * @alias Buffer.writeUIntLE
471 * @since v12.19.0
472 */
473 writeUintLE(value: number, offset: number, byteLength: number): number;
474 writeUIntBE(value: number, offset: number, byteLength: number): number;
475 /**
476 * @alias Buffer.writeUIntBE
477 * @since v12.19.0
478 */
479 writeUintBE(value: number, offset: number, byteLength: number): number;
480 writeIntLE(value: number, offset: number, byteLength: number): number;
481 writeIntBE(value: number, offset: number, byteLength: number): number;
482 readUIntLE(offset: number, byteLength: number): number;
483 /**
484 * @alias Buffer.readUIntLE
485 * @since v12.19.0
486 */
487 readUintLE(offset: number, byteLength: number): number;
488 readUIntBE(offset: number, byteLength: number): number;
489 /**
490 * @alias Buffer.readUIntBE
491 * @since v12.19.0
492 */
493 readUintBE(offset: number, byteLength: number): number;
494 readIntLE(offset: number, byteLength: number): number;
495 readIntBE(offset: number, byteLength: number): number;
496 readUInt8(offset?: number): number;
497 /**
498 * @alias Buffer.readUInt8
499 * @since v12.19.0
500 */
501 readUint8(offset?: number): number;
502 readUInt16LE(offset?: number): number;
503 /**
504 * @alias Buffer.readUInt16LE
505 * @since v12.19.0
506 */
507 readUint16LE(offset?: number): number;
508 readUInt16BE(offset?: number): number;
509 /**
510 * @alias Buffer.readUInt16BE
511 * @since v12.19.0
512 */
513 readUint16BE(offset?: number): number;
514 readUInt32LE(offset?: number): number;
515 /**
516 * @alias Buffer.readUInt32LE
517 * @since v12.19.0
518 */
519 readUint32LE(offset?: number): number;
520 readUInt32BE(offset?: number): number;
521 /**
522 * @alias Buffer.readUInt32BE
523 * @since v12.19.0
524 */
525 readUint32BE(offset?: number): number;
526 readInt8(offset?: number): number;
527 readInt16LE(offset?: number): number;
528 readInt16BE(offset?: number): number;
529 readInt32LE(offset?: number): number;
530 readInt32BE(offset?: number): number;
531 readFloatLE(offset?: number): number;
532 readDoubleLE(offset?: number): number;
533 readDoubleBE(offset?: number): number;
534 reverse(): this;
535 swap16(): Buffer;
536 swap32(): Buffer;
537 swap64(): Buffer;
538 writeUInt8(value: number, offset?: number): number;
539 /**
540 * @alias Buffer.writeUInt8
541 * @since v12.19.0
542 */
543 writeUint8(value: number, offset?: number): number;
544 writeUInt16LE(value: number, offset?: number): number;
545 /**
546 * @alias Buffer.writeUInt16LE
547 * @since v12.19.0
548 */
549 writeUint16LE(value: number, offset?: number): number;
550 writeUInt16BE(value: number, offset?: number): number;
551 /**
552 * @alias Buffer.writeUInt16BE
553 * @since v12.19.0
554 */
555 writeUint16BE(value: number, offset?: number): number;
556 writeUInt32LE(value: number, offset?: number): number;
557 /**
558 * @alias Buffer.writeUInt32LE
559 * @since v12.19.0
560 */
561 writeUint32LE(value: number, offset?: number): number;
562 writeUInt32BE(value: number, offset?: number): number;
563 /**
564 * @alias Buffer.writeUInt32BE
565 * @since v12.19.0
566 */
567 writeUint32BE(value: number, offset?: number): number;
568 writeInt8(value: number, offset?: number): number;
569 writeInt16LE(value: number, offset?: number): number;
570 writeInt16BE(value: number, offset?: number): number;
571 writeInt32LE(value: number, offset?: number): number;
572 writeInt32BE(value: number, offset?: number): number;
573 writeFloatLE(value: number, offset?: number): number;
574 writeFloatBE(value: number, offset?: number): number;
575 writeDoubleLE(value: number, offset?: number): number;
576 writeDoubleBE(value: number, offset?: number): number;
577
578 fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
579
580 indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
581 lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
582 entries(): IterableIterator<[number, number]>;
583 includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
584 keys(): IterableIterator<number>;
585 values(): IterableIterator<number>;
586}
587
588/*----------------------------------------------*
589* *
590* GLOBAL INTERFACES *
591* *
592*-----------------------------------------------*/
593declare namespace NodeJS {
594 interface InspectOptions {
595 /**
596 * If set to `true`, getters are going to be
597 * inspected as well. If set to `'get'` only getters without setter are going
598 * to be inspected. If set to `'set'` only getters having a corresponding
599 * setter are going to be inspected. This might cause side effects depending on
600 * the getter function.
601 * @default `false`
602 */
603 getters?: 'get' | 'set' | boolean | undefined;
604 showHidden?: boolean | undefined;
605 /**
606 * @default 2
607 */
608 depth?: number | null | undefined;
609 colors?: boolean | undefined;
610 customInspect?: boolean | undefined;
611 showProxy?: boolean | undefined;
612 maxArrayLength?: number | null | undefined;
613 breakLength?: number | undefined;
614 /**
615 * Setting this to `false` causes each object key
616 * to be displayed on a new line. It will also add new lines to text that is
617 * longer than `breakLength`. If set to a number, the most `n` inner elements
618 * are united on a single line as long as all properties fit into
619 * `breakLength`. Short array elements are also grouped together. Note that no
620 * text will be reduced below 16 characters, no matter the `breakLength` size.
621 * For more information, see the example below.
622 * @default `true`
623 */
624 compact?: boolean | number | undefined;
625 sorted?: boolean | ((a: string, b: string) => number) | undefined;
626 }
627
628 interface ConsoleConstructorOptions {
629 stdout: WritableStream;
630 stderr?: WritableStream | undefined;
631 ignoreErrors?: boolean | undefined;
632 colorMode?: boolean | 'auto' | undefined;
633 inspectOptions?: InspectOptions | undefined;
634 /**
635 * Set group indentation
636 * @default 2
637 */
638 groupIndentation?: number | undefined;
639 }
640
641 interface ConsoleConstructor {
642 prototype: Console;
643 new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console;
644 new(options: ConsoleConstructorOptions): Console;
645 }
646
647 interface CallSite {
648 /**
649 * Value of "this"
650 */
651 getThis(): any;
652
653 /**
654 * Type of "this" as a string.
655 * This is the name of the function stored in the constructor field of
656 * "this", if available. Otherwise the object's [[Class]] internal
657 * property.
658 */
659 getTypeName(): string | null;
660
661 /**
662 * Current function
663 */
664 getFunction(): Function | undefined;
665
666 /**
667 * Name of the current function, typically its name property.
668 * If a name property is not available an attempt will be made to try
669 * to infer a name from the function's context.
670 */
671 getFunctionName(): string | null;
672
673 /**
674 * Name of the property [of "this" or one of its prototypes] that holds
675 * the current function
676 */
677 getMethodName(): string | null;
678
679 /**
680 * Name of the script [if this function was defined in a script]
681 */
682 getFileName(): string | null;
683
684 /**
685 * Current line number [if this function was defined in a script]
686 */
687 getLineNumber(): number | null;
688
689 /**
690 * Current column number [if this function was defined in a script]
691 */
692 getColumnNumber(): number | null;
693
694 /**
695 * A call site object representing the location where eval was called
696 * [if this function was created using a call to eval]
697 */
698 getEvalOrigin(): string | undefined;
699
700 /**
701 * Is this a toplevel invocation, that is, is "this" the global object?
702 */
703 isToplevel(): boolean;
704
705 /**
706 * Does this call take place in code defined by a call to eval?
707 */
708 isEval(): boolean;
709
710 /**
711 * Is this call in native V8 code?
712 */
713 isNative(): boolean;
714
715 /**
716 * Is this a constructor call?
717 */
718 isConstructor(): boolean;
719 }
720
721 interface ErrnoException extends Error {
722 errno?: number | undefined;
723 code?: string | undefined;
724 path?: string | undefined;
725 syscall?: string | undefined;
726 }
727
728 class EventEmitter {
729 addListener(event: string | symbol, listener: (...args: any[]) => void): this;
730 on(event: string | symbol, listener: (...args: any[]) => void): this;
731 once(event: string | symbol, listener: (...args: any[]) => void): this;
732 removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
733 off(event: string | symbol, listener: (...args: any[]) => void): this;
734 removeAllListeners(event?: string | symbol): this;
735 setMaxListeners(n: number): this;
736 getMaxListeners(): number;
737 listeners(event: string | symbol): Function[];
738 rawListeners(event: string | symbol): Function[];
739 emit(event: string | symbol, ...args: any[]): boolean;
740 listenerCount(type: string | symbol): number;
741 // Added in Node 6...
742 prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
743 prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
744 eventNames(): Array<string | symbol>;
745 }
746
747 interface ReadableStream extends EventEmitter {
748 readable: boolean;
749 read(size?: number): string | Buffer;
750 setEncoding(encoding: string): this;
751 pause(): this;
752 resume(): this;
753 isPaused(): boolean;
754 pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
755 unpipe(destination?: WritableStream): this;
756 unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
757 wrap(oldStream: ReadableStream): this;
758 [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
759 }
760
761 interface WritableStream extends EventEmitter {
762 writable: boolean;
763 write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
764 write(str: string, encoding?: string, cb?: (err?: Error | null) => void): boolean;
765 end(cb?: () => void): this;
766 end(data: string | Uint8Array, cb?: () => void): this;
767 end(str: string, encoding?: string, cb?: () => void): this;
768 }
769
770 interface ReadWriteStream extends ReadableStream, WritableStream { }
771
772 interface Domain extends EventEmitter {
773 run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
774 add(emitter: EventEmitter | Timer): void;
775 remove(emitter: EventEmitter | Timer): void;
776 bind<T extends Function>(cb: T): T;
777 intercept<T extends Function>(cb: T): T;
778
779 addListener(event: string, listener: (...args: any[]) => void): this;
780 on(event: string, listener: (...args: any[]) => void): this;
781 once(event: string, listener: (...args: any[]) => void): this;
782 removeListener(event: string, listener: (...args: any[]) => void): this;
783 removeAllListeners(event?: string): this;
784 }
785
786 interface MemoryUsage {
787 rss: number;
788 heapTotal: number;
789 heapUsed: number;
790 external: number;
791 }
792
793 interface CpuUsage {
794 user: number;
795 system: number;
796 }
797
798 interface ProcessRelease {
799 name: string;
800 sourceUrl?: string | undefined;
801 headersUrl?: string | undefined;
802 libUrl?: string | undefined;
803 lts?: string | undefined;
804 }
805
806 interface ProcessVersions {
807 http_parser: string;
808 node: string;
809 v8: string;
810 ares: string;
811 uv: string;
812 zlib: string;
813 modules: string;
814 openssl: string;
815 }
816
817 type Platform = 'aix'
818 | 'android'
819 | 'darwin'
820 | 'freebsd'
821 | 'linux'
822 | 'openbsd'
823 | 'sunos'
824 | 'win32'
825 | 'cygwin'
826 | 'netbsd';
827
828 type Signals =
829 "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" |
830 "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" |
831 "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" |
832 "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
833
834 type MultipleResolveType = 'resolve' | 'reject';
835
836 type BeforeExitListener = (code: number) => void;
837 type DisconnectListener = () => void;
838 type ExitListener = (code: number) => void;
839 type RejectionHandledListener = (promise: Promise<any>) => void;
840 type UncaughtExceptionListener = (error: Error) => void;
841 type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<any>) => void;
842 type WarningListener = (warning: Error) => void;
843 type MessageListener = (message: any, sendHandle: any) => void;
844 type SignalsListener = (signal: Signals) => void;
845 type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
846 type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
847 type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<any>, value: any) => void;
848
849 interface Socket extends ReadWriteStream {
850 isTTY?: true | undefined;
851 }
852
853 interface ProcessEnv {
854 [key: string]: string | undefined;
855 }
856
857 interface HRTime {
858 (time?: [number, number]): [number, number];
859 bigint(): bigint;
860 }
861
862 interface ProcessReport {
863 /**
864 * Directory where the report is written.
865 * working directory of the Node.js process.
866 * @default '' indicating that reports are written to the current
867 */
868 directory: string;
869
870 /**
871 * Filename where the report is written.
872 * The default value is the empty string.
873 * @default '' the output filename will be comprised of a timestamp,
874 * PID, and sequence number.
875 */
876 filename: string;
877
878 /**
879 * Returns a JSON-formatted diagnostic report for the running process.
880 * The report's JavaScript stack trace is taken from err, if present.
881 */
882 getReport(err?: Error): string;
883
884 /**
885 * If true, a diagnostic report is generated on fatal errors,
886 * such as out of memory errors or failed C++ assertions.
887 * @default false
888 */
889 reportOnFatalError: boolean;
890
891 /**
892 * If true, a diagnostic report is generated when the process
893 * receives the signal specified by process.report.signal.
894 * @default false
895 */
896 reportOnSignal: boolean;
897
898 /**
899 * If true, a diagnostic report is generated on uncaught exception.
900 * @default false
901 */
902 reportOnUncaughtException: boolean;
903
904 /**
905 * The signal used to trigger the creation of a diagnostic report.
906 * @default 'SIGUSR2'
907 */
908 signal: Signals;
909
910 /**
911 * Writes a diagnostic report to a file. If filename is not provided, the default filename
912 * includes the date, time, PID, and a sequence number.
913 * The report's JavaScript stack trace is taken from err, if present.
914 *
915 * @param fileName Name of the file where the report is written.
916 * This should be a relative path, that will be appended to the directory specified in
917 * `process.report.directory`, or the current working directory of the Node.js process,
918 * if unspecified.
919 * @param error A custom error used for reporting the JavaScript stack.
920 * @return Filename of the generated report.
921 */
922 writeReport(fileName?: string): string;
923 writeReport(error?: Error): string;
924 writeReport(fileName?: string, err?: Error): string;
925 }
926
927 interface ResourceUsage {
928 fsRead: number;
929 fsWrite: number;
930 involuntaryContextSwitches: number;
931 ipcReceived: number;
932 ipcSent: number;
933 majorPageFault: number;
934 maxRSS: number;
935 minorPageFault: number;
936 sharedMemorySize: number;
937 signalsCount: number;
938 swappedOut: number;
939 systemCPUTime: number;
940 unsharedDataSize: number;
941 unsharedStackSize: number;
942 userCPUTime: number;
943 voluntaryContextSwitches: number;
944 }
945
946 interface EmitWarningOptions {
947 /**
948 * When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted.
949 *
950 * @default 'Warning'
951 */
952 type?: string | undefined;
953
954 /**
955 * A unique identifier for the warning instance being emitted.
956 */
957 code?: string | undefined;
958
959 /**
960 * When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace.
961 *
962 * @default process.emitWarning
963 */
964 ctor?: Function | undefined;
965
966 /**
967 * Additional text to include with the error.
968 */
969 detail?: string | undefined;
970 }
971
972 interface Process extends EventEmitter {
973 /**
974 * Can also be a tty.WriteStream, not typed due to limitation.s
975 */
976 stdout: WriteStream;
977 /**
978 * Can also be a tty.WriteStream, not typed due to limitation.s
979 */
980 stderr: WriteStream;
981 stdin: ReadStream;
982 openStdin(): Socket;
983 argv: string[];
984 argv0: string;
985 execArgv: string[];
986 execPath: string;
987 abort(): never;
988 chdir(directory: string): void;
989 cwd(): string;
990 debugPort: number;
991
992 /**
993 * The `process.emitWarning()` method can be used to emit custom or application specific process warnings.
994 *
995 * These can be listened for by adding a handler to the `'warning'` event.
996 *
997 * @param warning The warning to emit.
998 * @param type When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted. Default: `'Warning'`.
999 * @param code A unique identifier for the warning instance being emitted.
1000 * @param ctor When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace. Default: `process.emitWarning`.
1001 */
1002 emitWarning(warning: string | Error, ctor?: Function): void;
1003 emitWarning(warning: string | Error, type?: string, ctor?: Function): void;
1004 emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void;
1005 emitWarning(warning: string | Error, options?: EmitWarningOptions): void;
1006
1007 env: ProcessEnv;
1008 exit(code?: number): never;
1009 exitCode?: number | undefined;
1010 getgid(): number;
1011 setgid(id: number | string): void;
1012 getuid(): number;
1013 setuid(id: number | string): void;
1014 geteuid(): number;
1015 seteuid(id: number | string): void;
1016 getegid(): number;
1017 setegid(id: number | string): void;
1018 getgroups(): number[];
1019 setgroups(groups: ReadonlyArray<string | number>): void;
1020 setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
1021 hasUncaughtExceptionCaptureCallback(): boolean;
1022 version: string;
1023 versions: ProcessVersions;
1024 config: {
1025 target_defaults: {
1026 cflags: any[];
1027 default_configuration: string;
1028 defines: string[];
1029 include_dirs: string[];
1030 libraries: string[];
1031 };
1032 variables: {
1033 clang: number;
1034 host_arch: string;
1035 node_install_npm: boolean;
1036 node_install_waf: boolean;
1037 node_prefix: string;
1038 node_shared_openssl: boolean;
1039 node_shared_v8: boolean;
1040 node_shared_zlib: boolean;
1041 node_use_dtrace: boolean;
1042 node_use_etw: boolean;
1043 node_use_openssl: boolean;
1044 target_arch: string;
1045 v8_no_strict_aliasing: number;
1046 v8_use_snapshot: boolean;
1047 visibility: string;
1048 };
1049 };
1050 kill(pid: number, signal?: string | number): true;
1051 pid: number;
1052 ppid: number;
1053 title: string;
1054 arch: string;
1055 platform: Platform;
1056 mainModule?: NodeModule | undefined;
1057 memoryUsage(): MemoryUsage;
1058 cpuUsage(previousValue?: CpuUsage): CpuUsage;
1059 nextTick(callback: Function, ...args: any[]): void;
1060 release: ProcessRelease;
1061 features: {
1062 inspector: boolean;
1063 debug: boolean;
1064 uv: boolean;
1065 ipv6: boolean;
1066 tls_alpn: boolean;
1067 tls_sni: boolean;
1068 tls_ocsp: boolean;
1069 tls: boolean;
1070 };
1071 /**
1072 * @deprecated since v12.19.0 - Calling process.umask() with no argument causes
1073 * the process-wide umask to be written twice. This introduces a race condition between threads,
1074 * and is a potential security vulnerability. There is no safe, cross-platform alternative API.
1075 */
1076 umask(): number;
1077 /**
1078 * Can only be set if not in worker thread.
1079 */
1080 umask(mask: string | number): number;
1081 uptime(): number;
1082 hrtime: HRTime;
1083 domain: Domain;
1084
1085 // Worker
1086 send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean | undefined}, callback?: (error: Error | null) => void): boolean;
1087 disconnect(): void;
1088 connected: boolean;
1089
1090 /**
1091 * The `process.allowedNodeEnvironmentFlags` property is a special,
1092 * read-only `Set` of flags allowable within the [`NODE_OPTIONS`][]
1093 * environment variable.
1094 */
1095 allowedNodeEnvironmentFlags: ReadonlySet<string>;
1096
1097 /**
1098 * Only available with `--experimental-report`
1099 */
1100 report?: ProcessReport | undefined;
1101
1102 resourceUsage(): ResourceUsage;
1103
1104 /**
1105 * EventEmitter
1106 * 1. beforeExit
1107 * 2. disconnect
1108 * 3. exit
1109 * 4. message
1110 * 5. rejectionHandled
1111 * 6. uncaughtException
1112 * 7. unhandledRejection
1113 * 8. warning
1114 * 9. message
1115 * 10. <All OS Signals>
1116 * 11. newListener/removeListener inherited from EventEmitter
1117 */
1118 addListener(event: "beforeExit", listener: BeforeExitListener): this;
1119 addListener(event: "disconnect", listener: DisconnectListener): this;
1120 addListener(event: "exit", listener: ExitListener): this;
1121 addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
1122 addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1123 addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1124 addListener(event: "warning", listener: WarningListener): this;
1125 addListener(event: "message", listener: MessageListener): this;
1126 addListener(event: Signals, listener: SignalsListener): this;
1127 addListener(event: "newListener", listener: NewListenerListener): this;
1128 addListener(event: "removeListener", listener: RemoveListenerListener): this;
1129 addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
1130
1131 emit(event: "beforeExit", code: number): boolean;
1132 emit(event: "disconnect"): boolean;
1133 emit(event: "exit", code: number): boolean;
1134 emit(event: "rejectionHandled", promise: Promise<any>): boolean;
1135 emit(event: "uncaughtException", error: Error): boolean;
1136 emit(event: "unhandledRejection", reason: any, promise: Promise<any>): boolean;
1137 emit(event: "warning", warning: Error): boolean;
1138 emit(event: "message", message: any, sendHandle: any): this;
1139 emit(event: Signals, signal: Signals): boolean;
1140 emit(event: "newListener", eventName: string | symbol, listener: (...args: any[]) => void): this;
1141 emit(event: "removeListener", eventName: string, listener: (...args: any[]) => void): this;
1142 emit(event: "multipleResolves", listener: MultipleResolveListener): this;
1143
1144 on(event: "beforeExit", listener: BeforeExitListener): this;
1145 on(event: "disconnect", listener: DisconnectListener): this;
1146 on(event: "exit", listener: ExitListener): this;
1147 on(event: "rejectionHandled", listener: RejectionHandledListener): this;
1148 on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1149 on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1150 on(event: "warning", listener: WarningListener): this;
1151 on(event: "message", listener: MessageListener): this;
1152 on(event: Signals, listener: SignalsListener): this;
1153 on(event: "newListener", listener: NewListenerListener): this;
1154 on(event: "removeListener", listener: RemoveListenerListener): this;
1155 on(event: "multipleResolves", listener: MultipleResolveListener): this;
1156
1157 once(event: "beforeExit", listener: BeforeExitListener): this;
1158 once(event: "disconnect", listener: DisconnectListener): this;
1159 once(event: "exit", listener: ExitListener): this;
1160 once(event: "rejectionHandled", listener: RejectionHandledListener): this;
1161 once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1162 once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1163 once(event: "warning", listener: WarningListener): this;
1164 once(event: "message", listener: MessageListener): this;
1165 once(event: Signals, listener: SignalsListener): this;
1166 once(event: "newListener", listener: NewListenerListener): this;
1167 once(event: "removeListener", listener: RemoveListenerListener): this;
1168 once(event: "multipleResolves", listener: MultipleResolveListener): this;
1169
1170 prependListener(event: "beforeExit", listener: BeforeExitListener): this;
1171 prependListener(event: "disconnect", listener: DisconnectListener): this;
1172 prependListener(event: "exit", listener: ExitListener): this;
1173 prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
1174 prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1175 prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1176 prependListener(event: "warning", listener: WarningListener): this;
1177 prependListener(event: "message", listener: MessageListener): this;
1178 prependListener(event: Signals, listener: SignalsListener): this;
1179 prependListener(event: "newListener", listener: NewListenerListener): this;
1180 prependListener(event: "removeListener", listener: RemoveListenerListener): this;
1181 prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
1182
1183 prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
1184 prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
1185 prependOnceListener(event: "exit", listener: ExitListener): this;
1186 prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
1187 prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1188 prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1189 prependOnceListener(event: "warning", listener: WarningListener): this;
1190 prependOnceListener(event: "message", listener: MessageListener): this;
1191 prependOnceListener(event: Signals, listener: SignalsListener): this;
1192 prependOnceListener(event: "newListener", listener: NewListenerListener): this;
1193 prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this;
1194 prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
1195
1196 listeners(event: "beforeExit"): BeforeExitListener[];
1197 listeners(event: "disconnect"): DisconnectListener[];
1198 listeners(event: "exit"): ExitListener[];
1199 listeners(event: "rejectionHandled"): RejectionHandledListener[];
1200 listeners(event: "uncaughtException"): UncaughtExceptionListener[];
1201 listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
1202 listeners(event: "warning"): WarningListener[];
1203 listeners(event: "message"): MessageListener[];
1204 listeners(event: Signals): SignalsListener[];
1205 listeners(event: "newListener"): NewListenerListener[];
1206 listeners(event: "removeListener"): RemoveListenerListener[];
1207 listeners(event: "multipleResolves"): MultipleResolveListener[];
1208 }
1209
1210 interface Global {
1211 Array: typeof Array;
1212 ArrayBuffer: typeof ArrayBuffer;
1213 Boolean: typeof Boolean;
1214 Buffer: typeof Buffer;
1215 DataView: typeof DataView;
1216 Date: typeof Date;
1217 Error: typeof Error;
1218 EvalError: typeof EvalError;
1219 Float32Array: typeof Float32Array;
1220 Float64Array: typeof Float64Array;
1221 Function: typeof Function;
1222 GLOBAL: Global;
1223 Infinity: typeof Infinity;
1224 Int16Array: typeof Int16Array;
1225 Int32Array: typeof Int32Array;
1226 Int8Array: typeof Int8Array;
1227 Intl: typeof Intl;
1228 JSON: typeof JSON;
1229 Map: MapConstructor;
1230 Math: typeof Math;
1231 NaN: typeof NaN;
1232 Number: typeof Number;
1233 Object: typeof Object;
1234 Promise: Function;
1235 RangeError: typeof RangeError;
1236 ReferenceError: typeof ReferenceError;
1237 RegExp: typeof RegExp;
1238 Set: SetConstructor;
1239 String: typeof String;
1240 Symbol: Function;
1241 SyntaxError: typeof SyntaxError;
1242 TypeError: typeof TypeError;
1243 URIError: typeof URIError;
1244 Uint16Array: typeof Uint16Array;
1245 Uint32Array: typeof Uint32Array;
1246 Uint8Array: typeof Uint8Array;
1247 Uint8ClampedArray: Function;
1248 WeakMap: WeakMapConstructor;
1249 WeakSet: WeakSetConstructor;
1250 clearImmediate: (immediateId: Immediate) => void;
1251 clearInterval: (intervalId: Timeout) => void;
1252 clearTimeout: (timeoutId: Timeout) => void;
1253 console: typeof console;
1254 decodeURI: typeof decodeURI;
1255 decodeURIComponent: typeof decodeURIComponent;
1256 encodeURI: typeof encodeURI;
1257 encodeURIComponent: typeof encodeURIComponent;
1258 escape: (str: string) => string;
1259 eval: typeof eval;
1260 global: Global;
1261 isFinite: typeof isFinite;
1262 isNaN: typeof isNaN;
1263 parseFloat: typeof parseFloat;
1264 parseInt: typeof parseInt;
1265 process: Process;
1266 root: Global;
1267 setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => Immediate;
1268 setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;
1269 setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;
1270 queueMicrotask: typeof queueMicrotask;
1271 undefined: typeof undefined;
1272 unescape: (str: string) => string;
1273 gc: () => void;
1274 v8debug?: any;
1275 }
1276
1277 // compatibility with older typings
1278 interface Timer {
1279 hasRef(): boolean;
1280 ref(): this;
1281 refresh(): this;
1282 unref(): this;
1283 [Symbol.toPrimitive](): number;
1284 }
1285
1286 class Immediate {
1287 hasRef(): boolean;
1288 ref(): this;
1289 unref(): this;
1290 _onImmediate: Function; // to distinguish it from the Timeout class
1291 }
1292
1293 class Timeout implements Timer {
1294 hasRef(): boolean;
1295 ref(): this;
1296 refresh(): this;
1297 unref(): this;
1298 [Symbol.toPrimitive](): number;
1299 }
1300
1301 class Module {
1302 static runMain(): void;
1303 static wrap(code: string): string;
1304
1305 /**
1306 * @deprecated Deprecated since: v12.2.0. Please use createRequire() instead.
1307 */
1308 static createRequireFromPath(path: string): NodeRequire;
1309 static createRequire(path: string): NodeRequire;
1310 static builtinModules: string[];
1311
1312 static Module: typeof Module;
1313
1314 exports: any;
1315 require: NodeRequireFunction;
1316 id: string;
1317 filename: string;
1318 loaded: boolean;
1319 /** @deprecated since 12.19.0 Please use `require.main` and `module.children` instead. */
1320 parent: Module | null | undefined;
1321 children: Module[];
1322 /**
1323 * @since 11.14.0
1324 *
1325 * The directory name of the module. This is usually the same as the path.dirname() of the module.id.
1326 */
1327 path: string;
1328 paths: string[];
1329
1330 constructor(id: string, parent?: Module);
1331 }
1332
1333 interface Dict<T> {
1334 [key: string]: T | undefined;
1335 }
1336
1337 type TypedArray =
1338 | Uint8Array
1339 | Uint8ClampedArray
1340 | Uint16Array
1341 | Uint32Array
1342 | Int8Array
1343 | Int16Array
1344 | Int32Array
1345 | BigUint64Array
1346 | BigInt64Array
1347 | Float32Array
1348 | Float64Array;
1349 type ArrayBufferView = TypedArray | DataView;
1350}
1351
\No newline at end of file