@types/node 15.0.3 → 15.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 12 May 2021 19:31:25 GMT
11
+ * Last updated: Fri, 14 May 2021 19:01:37 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14
14
 
node/child_process.d.ts CHANGED
@@ -41,6 +41,7 @@ declare module 'child_process' {
41
41
  * 3. error
42
42
  * 4. exit
43
43
  * 5. message
44
+ * 6. spawn
44
45
  */
45
46
 
46
47
  addListener(event: string, listener: (...args: any[]) => void): this;
@@ -49,6 +50,7 @@ declare module 'child_process' {
49
50
  addListener(event: "error", listener: (err: Error) => void): this;
50
51
  addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
51
52
  addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
53
+ addListener(event: "spawn", listener: () => void): this;
52
54
 
53
55
  emit(event: string | symbol, ...args: any[]): boolean;
54
56
  emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
@@ -56,6 +58,7 @@ declare module 'child_process' {
56
58
  emit(event: "error", err: Error): boolean;
57
59
  emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
58
60
  emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
61
+ emit(event: "spawn", listener: () => void): boolean;
59
62
 
60
63
  on(event: string, listener: (...args: any[]) => void): this;
61
64
  on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
@@ -63,6 +66,7 @@ declare module 'child_process' {
63
66
  on(event: "error", listener: (err: Error) => void): this;
64
67
  on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
65
68
  on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
69
+ on(event: "spawn", listener: () => void): this;
66
70
 
67
71
  once(event: string, listener: (...args: any[]) => void): this;
68
72
  once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
@@ -70,6 +74,7 @@ declare module 'child_process' {
70
74
  once(event: "error", listener: (err: Error) => void): this;
71
75
  once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
72
76
  once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
77
+ once(event: "spawn", listener: () => void): this;
73
78
 
74
79
  prependListener(event: string, listener: (...args: any[]) => void): this;
75
80
  prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
@@ -77,6 +82,7 @@ declare module 'child_process' {
77
82
  prependListener(event: "error", listener: (err: Error) => void): this;
78
83
  prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
79
84
  prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
85
+ prependListener(event: "spawn", listener: () => void): this;
80
86
 
81
87
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
82
88
  prependOnceListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
@@ -84,6 +90,7 @@ declare module 'child_process' {
84
90
  prependOnceListener(event: "error", listener: (err: Error) => void): this;
85
91
  prependOnceListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
86
92
  prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
93
+ prependOnceListener(event: "spawn", listener: () => void): this;
87
94
  }
88
95
 
89
96
  // return this object when stdio option is undefined or not specified
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @experimental
3
+ */
4
+ declare module 'diagnostic_channel' {
5
+ /**
6
+ * Returns wether a named channel has subscribers or not.
7
+ */
8
+ function hasSubscribers(name: string): boolean;
9
+
10
+ /**
11
+ * Gets or create a diagnostic channel by name.
12
+ */
13
+ function channel(name: string): Channel;
14
+
15
+ type ChannelListener = (name: string, message: unknown) => void;
16
+
17
+ /**
18
+ * Simple diagnostic channel that allows
19
+ */
20
+ class Channel {
21
+ readonly name: string;
22
+ readonly hashSubscribers: boolean;
23
+ private constructor(name: string);
24
+
25
+ /**
26
+ * Add a listener to the message channel.
27
+ */
28
+ subscribe(listener: ChannelListener): void;
29
+ /**
30
+ * Removes a previously registered listener.
31
+ */
32
+ unsubscribe(listener: ChannelListener): void;
33
+ }
34
+ }
node/events.d.ts CHANGED
@@ -28,6 +28,10 @@ declare module 'events' {
28
28
 
29
29
  /** @deprecated since v4.0.0 */
30
30
  static listenerCount(emitter: NodeJS.EventEmitter, event: string | symbol): number;
31
+ /**
32
+ * Returns a list listener for a specific emitter event name.
33
+ */
34
+ static getEventListener(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
31
35
 
32
36
  /**
33
37
  * This symbol shall be used to install a listener for only monitoring `'error'`
node/fs/promises.d.ts CHANGED
@@ -16,6 +16,7 @@ declare module 'fs/promises' {
16
16
  BufferEncodingOption,
17
17
  OpenMode,
18
18
  Mode,
19
+ Abortable,
19
20
  } from 'fs';
20
21
 
21
22
  interface FileHandle {
@@ -143,7 +144,7 @@ declare module 'fs/promises' {
143
144
  * If `mode` is a string, it is parsed as an octal integer.
144
145
  * If `flag` is not supplied, the default of `'w'` is used.
145
146
  */
146
- writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
147
+ writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } & Abortable | BufferEncoding | null): Promise<void>;
147
148
 
148
149
  /**
149
150
  * See `fs.writev` promisified version.
@@ -510,7 +511,7 @@ declare module 'fs/promises' {
510
511
  * If `mode` is a string, it is parsed as an octal integer.
511
512
  * If `flag` is not supplied, the default of `'w'` is used.
512
513
  */
513
- function writeFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
514
+ function writeFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } & Abortable | BufferEncoding | null): Promise<void>;
514
515
 
515
516
  /**
516
517
  * Asynchronously append data to a file, creating the file if it does not exist.
@@ -533,7 +534,7 @@ declare module 'fs/promises' {
533
534
  * @param options An object that may contain an optional flag.
534
535
  * If a flag is not provided, it defaults to `'r'`.
535
536
  */
536
- function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: OpenMode } | null): Promise<Buffer>;
537
+ function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: OpenMode } & Abortable | null): Promise<Buffer>;
537
538
 
538
539
  /**
539
540
  * Asynchronously reads the entire contents of a file.
@@ -542,7 +543,7 @@ declare module 'fs/promises' {
542
543
  * @param options An object that may contain an optional flag.
543
544
  * If a flag is not provided, it defaults to `'r'`.
544
545
  */
545
- function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode } | BufferEncoding): Promise<string>;
546
+ function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode } & Abortable | BufferEncoding): Promise<string>;
546
547
 
547
548
  /**
548
549
  * Asynchronously reads the entire contents of a file.
@@ -551,7 +552,7 @@ declare module 'fs/promises' {
551
552
  * @param options An object that may contain an optional flag.
552
553
  * If a flag is not provided, it defaults to `'r'`.
553
554
  */
554
- function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & { flag?: OpenMode } | BufferEncoding | null): Promise<string | Buffer>;
555
+ function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & Abortable & { flag?: OpenMode } | BufferEncoding | null): Promise<string | Buffer>;
555
556
 
556
557
  function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
557
558
  }
node/fs.d.ts CHANGED
@@ -142,6 +142,11 @@ declare module 'fs' {
142
142
  prependOnceListener(event: "close", listener: () => void): this;
143
143
  }
144
144
 
145
+ // TODO: Move this to a more central location
146
+ export interface Abortable {
147
+ signal?: AbortSignal;
148
+ }
149
+
145
150
  export class ReadStream extends stream.Readable {
146
151
  close(): void;
147
152
  bytesRead: number;
@@ -552,13 +557,21 @@ declare module 'fs' {
552
557
  function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
553
558
  }
554
559
 
560
+ export interface StatSyncFn<TDescriptor = PathLike> extends Function {
561
+ (path: TDescriptor, options?: undefined): Stats;
562
+ (path: TDescriptor, options?: StatOptions & { bigint?: false; throwIfNoEntry: false }): Stats | undefined;
563
+ (path: TDescriptor, options: StatOptions & { bigint: true; throwIfNoEntry: false }): BigIntStats | undefined;
564
+ (path: TDescriptor, options?: StatOptions & { bigint?: false }): Stats;
565
+ (path: TDescriptor, options: StatOptions & { bigint: true }): BigIntStats;
566
+ (path: TDescriptor, options: StatOptions & { bigint: boolean; throwIfNoEntry?: false }): Stats | BigIntStats;
567
+ (path: TDescriptor, options?: StatOptions): Stats | BigIntStats | undefined;
568
+ }
569
+
555
570
  /**
556
571
  * Synchronous stat(2) - Get file status.
557
572
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
558
573
  */
559
- export function statSync(path: PathLike, options?: StatOptions & { bigint?: false }): Stats;
560
- export function statSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
561
- export function statSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
574
+ export const statSync: StatSyncFn;
562
575
 
563
576
  /**
564
577
  * Asynchronous fstat(2) - Get file status.
@@ -584,9 +597,7 @@ declare module 'fs' {
584
597
  * Synchronous fstat(2) - Get file status.
585
598
  * @param fd A file descriptor.
586
599
  */
587
- export function fstatSync(fd: number, options?: StatOptions & { bigint?: false }): Stats;
588
- export function fstatSync(fd: number, options: StatOptions & { bigint: true }): BigIntStats;
589
- export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
600
+ export const fstatSync: StatSyncFn<number>;
590
601
 
591
602
  /**
592
603
  * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
@@ -612,10 +623,7 @@ declare module 'fs' {
612
623
  * Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
613
624
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
614
625
  */
615
- export function lstatSync(path: PathLike, options?: StatOptions & { bigint?: false }): Stats;
616
- export function lstatSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
617
- export function lstatSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
618
-
626
+ export const lstatSync: StatSyncFn;
619
627
  /**
620
628
  * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
621
629
  * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1557,7 +1565,11 @@ declare module 'fs' {
1557
1565
  * @param options An object that may contain an optional flag.
1558
1566
  * If a flag is not provided, it defaults to `'r'`.
1559
1567
  */
1560
- export function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
1568
+ export function readFile(
1569
+ path: PathLike | number,
1570
+ options: { encoding?: null; flag?: string; } & Abortable | undefined | null,
1571
+ callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
1572
+ ): void;
1561
1573
 
1562
1574
  /**
1563
1575
  * Asynchronously reads the entire contents of a file.
@@ -1567,7 +1579,11 @@ declare module 'fs' {
1567
1579
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1568
1580
  * If a flag is not provided, it defaults to `'r'`.
1569
1581
  */
1570
- export function readFile(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void;
1582
+ export function readFile(
1583
+ path: PathLike | number,
1584
+ options: { encoding: BufferEncoding; flag?: string; } & Abortable | string,
1585
+ callback: (err: NodeJS.ErrnoException | null, data: string) => void,
1586
+ ): void;
1571
1587
 
1572
1588
  /**
1573
1589
  * Asynchronously reads the entire contents of a file.
@@ -1579,7 +1595,8 @@ declare module 'fs' {
1579
1595
  */
1580
1596
  export function readFile(
1581
1597
  path: PathLike | number,
1582
- options: BaseEncodingOptions & { flag?: string; } | string | undefined | null,
1598
+ // TODO: unify the options across all readfile functions
1599
+ options: BaseEncodingOptions & { flag?: string; } & Abortable | string | undefined | null,
1583
1600
  callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
1584
1601
  ): void;
1585
1602
 
@@ -1651,7 +1668,7 @@ declare module 'fs' {
1651
1668
  */
1652
1669
  export function readFileSync(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string; } | BufferEncoding | null): string | Buffer;
1653
1670
 
1654
- export type WriteFileOptions = BaseEncodingOptions & { mode?: Mode; flag?: string; } | string | null;
1671
+ export type WriteFileOptions = (BaseEncodingOptions & Abortable & { mode?: Mode; flag?: string; }) | string | null;
1655
1672
 
1656
1673
  /**
1657
1674
  * Asynchronously writes data to a file, replacing the file if it already exists.
@@ -2253,5 +2270,6 @@ declare module 'fs' {
2253
2270
 
2254
2271
  export interface StatOptions {
2255
2272
  bigint?: boolean;
2273
+ throwIfNoEntry?: boolean;
2256
2274
  }
2257
2275
  }
node/http.d.ts CHANGED
@@ -77,6 +77,7 @@ declare module 'http' {
77
77
  }
78
78
 
79
79
  interface ClientRequestArgs {
80
+ abort?: AbortSignal;
80
81
  protocol?: string | null;
81
82
  host?: string | null;
82
83
  hostname?: string | null;
node/http2.d.ts CHANGED
@@ -466,7 +466,16 @@ declare module 'http2' {
466
466
  origins?: string[];
467
467
  }
468
468
 
469
- export interface Http2Server extends net.Server {
469
+ interface HTTP2ServerCommon {
470
+ setTimeout(msec?: number, callback?: () => void): this;
471
+ /**
472
+ * Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values.
473
+ * Throws ERR_INVALID_ARG_TYPE for invalid settings argument.
474
+ */
475
+ updateSettings(settings: Settings): void;
476
+ }
477
+
478
+ export interface Http2Server extends net.Server, HTTP2ServerCommon {
470
479
  addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
471
480
  addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
472
481
  addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
@@ -514,11 +523,9 @@ declare module 'http2' {
514
523
  prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
515
524
  prependOnceListener(event: "timeout", listener: () => void): this;
516
525
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
517
-
518
- setTimeout(msec?: number, callback?: () => void): this;
519
526
  }
520
527
 
521
- export interface Http2SecureServer extends tls.Server {
528
+ export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon {
522
529
  addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
523
530
  addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
524
531
  addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
@@ -572,8 +579,6 @@ declare module 'http2' {
572
579
  prependOnceListener(event: "timeout", listener: () => void): this;
573
580
  prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
574
581
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
575
-
576
- setTimeout(msec?: number, callback?: () => void): this;
577
582
  }
578
583
 
579
584
  export class Http2ServerRequest extends stream.Readable {
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 15.0
1
+ // Type definitions for non-npm package Node.js 15.3
2
2
  // Project: http://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "15.0.3",
3
+ "version": "15.3.0",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -226,6 +226,6 @@
226
226
  },
227
227
  "scripts": {},
228
228
  "dependencies": {},
229
- "typesPublisherContentHash": "7eb5009dd18ced46416312bd99ea35153ef26b85864ab15d6e7d84966531879b",
229
+ "typesPublisherContentHash": "db9f33705bb813befe4fef062f49dad7d922e4feb6d132c446fd94911812a697",
230
230
  "typeScriptVersion": "3.5"
231
231
  }
node/path.d.ts CHANGED
@@ -1,3 +1,13 @@
1
+ declare module 'path/posix' {
2
+ import path = require('path');
3
+ export = path;
4
+ }
5
+
6
+ declare module 'path/win32' {
7
+ import path = require('path');
8
+ export = path;
9
+ }
10
+
1
11
  declare module 'path' {
2
12
  namespace path {
3
13
  /**
node/perf_hooks.d.ts CHANGED
@@ -84,6 +84,12 @@ declare module 'perf_hooks' {
84
84
  utilization: number;
85
85
  }
86
86
 
87
+ /**
88
+ * @param util1 The result of a previous call to eventLoopUtilization()
89
+ * @param util2 The result of a previous call to eventLoopUtilization() prior to util1
90
+ */
91
+ type EventLoopUtilityFunction = (util1?: EventLoopUtilization, util2?: EventLoopUtilization) => EventLoopUtilization;
92
+
87
93
  interface Performance {
88
94
  /**
89
95
  * If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
@@ -144,11 +150,8 @@ declare module 'perf_hooks' {
144
150
  * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
145
151
  * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
146
152
  * No other CPU idle time is taken into consideration.
147
- *
148
- * @param util1 The result of a previous call to eventLoopUtilization()
149
- * @param util2 The result of a previous call to eventLoopUtilization() prior to util1
150
153
  */
151
- eventLoopUtilization(util1?: EventLoopUtilization, util2?: EventLoopUtilization): EventLoopUtilization;
154
+ eventLoopUtilization: EventLoopUtilityFunction;
152
155
  }
153
156
 
154
157
  interface PerformanceObserverEntryList {
node/readline.d.ts CHANGED
@@ -38,6 +38,7 @@ declare module 'readline' {
38
38
  */
39
39
  protected constructor(options: ReadLineOptions);
40
40
 
41
+ getPrompt(): string;
41
42
  setPrompt(prompt: string): void;
42
43
  prompt(preserveCursor?: boolean): void;
43
44
  question(query: string, callback: (answer: string) => void): void;
node/ts3.6/base.d.ts CHANGED
@@ -23,6 +23,7 @@
23
23
  /// <reference path="../constants.d.ts" />
24
24
  /// <reference path="../crypto.d.ts" />
25
25
  /// <reference path="../dgram.d.ts" />
26
+ /// <reference path="../diagnostic_channel.d.ts" />
26
27
  /// <reference path="../dns.d.ts" />
27
28
  /// <reference path="../dns/promises.d.ts" />
28
29
  /// <reference path="../dns/promises.d.ts" />
@@ -54,6 +55,7 @@
54
55
  /// <reference path="../tty.d.ts" />
55
56
  /// <reference path="../url.d.ts" />
56
57
  /// <reference path="../util.d.ts" />
58
+ /// <reference path="../util/types.d.ts" />
57
59
  /// <reference path="../v8.d.ts" />
58
60
  /// <reference path="../vm.d.ts" />
59
61
  /// <reference path="../worker_threads.d.ts" />
node/util/types.d.ts ADDED
@@ -0,0 +1,57 @@
1
+ declare module 'util/types' {
2
+ function isAnyArrayBuffer(object: any): object is ArrayBufferLike;
3
+ function isArgumentsObject(object: any): object is IArguments;
4
+ function isArrayBuffer(object: any): object is ArrayBuffer;
5
+ function isArrayBufferView(object: any): object is NodeJS.ArrayBufferView;
6
+ function isAsyncFunction(object: any): boolean;
7
+ function isBigInt64Array(value: any): value is BigInt64Array;
8
+ function isBigUint64Array(value: any): value is BigUint64Array;
9
+ function isBooleanObject(object: any): object is Boolean;
10
+ function isBoxedPrimitive(object: any): object is String | Number | BigInt | Boolean | Symbol;
11
+ function isDataView(object: any): object is DataView;
12
+ function isDate(object: any): object is Date;
13
+ function isExternal(object: any): boolean;
14
+ function isFloat32Array(object: any): object is Float32Array;
15
+ function isFloat64Array(object: any): object is Float64Array;
16
+ function isGeneratorFunction(object: any): object is GeneratorFunction;
17
+ function isGeneratorObject(object: any): object is Generator;
18
+ function isInt8Array(object: any): object is Int8Array;
19
+ function isInt16Array(object: any): object is Int16Array;
20
+ function isInt32Array(object: any): object is Int32Array;
21
+ function isMap<T>(
22
+ object: T | {},
23
+ ): object is T extends ReadonlyMap<any, any>
24
+ ? unknown extends T
25
+ ? never
26
+ : ReadonlyMap<any, any>
27
+ : Map<any, any>;
28
+ function isMapIterator(object: any): boolean;
29
+ function isModuleNamespaceObject(value: any): boolean;
30
+ function isNativeError(object: any): object is Error;
31
+ function isNumberObject(object: any): object is Number;
32
+ function isPromise(object: any): object is Promise<any>;
33
+ function isProxy(object: any): boolean;
34
+ function isRegExp(object: any): object is RegExp;
35
+ function isSet<T>(
36
+ object: T | {},
37
+ ): object is T extends ReadonlySet<any>
38
+ ? unknown extends T
39
+ ? never
40
+ : ReadonlySet<any>
41
+ : Set<any>;
42
+ function isSetIterator(object: any): boolean;
43
+ function isSharedArrayBuffer(object: any): object is SharedArrayBuffer;
44
+ function isStringObject(object: any): object is String;
45
+ function isSymbolObject(object: any): object is Symbol;
46
+ function isTypedArray(object: any): object is NodeJS.TypedArray;
47
+ function isUint8Array(object: any): object is Uint8Array;
48
+ function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
49
+ function isUint16Array(object: any): object is Uint16Array;
50
+ function isUint32Array(object: any): object is Uint32Array;
51
+ function isWeakMap(object: any): object is WeakMap<any, any>;
52
+ function isWeakSet(object: any): object is WeakSet<any>;
53
+ }
54
+
55
+ declare module 'node:util/types' {
56
+ export * from 'util/types';
57
+ }
node/util.d.ts CHANGED
@@ -1,17 +1,19 @@
1
1
  declare module 'util' {
2
- interface InspectOptions extends NodeJS.InspectOptions { }
3
- type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module';
4
- type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string;
5
- interface InspectOptionsStylized extends InspectOptions {
2
+ import * as types from 'util/types';
3
+
4
+ export interface InspectOptions extends NodeJS.InspectOptions { }
5
+ export type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module';
6
+ export type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string;
7
+ export interface InspectOptionsStylized extends InspectOptions {
6
8
  stylize(text: string, styleType: Style): string;
7
9
  }
8
- function format(format?: any, ...param: any[]): string;
9
- function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string;
10
+ export function format(format?: any, ...param: any[]): string;
11
+ export function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string;
10
12
  /** @deprecated since v0.11.3 - use a third party module instead. */
11
- function log(string: string): void;
12
- function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
13
- function inspect(object: any, options: InspectOptions): string;
14
- namespace inspect {
13
+ export function log(string: string): void;
14
+ export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
15
+ export function inspect(object: any, options: InspectOptions): string;
16
+ export namespace inspect {
15
17
  let colors: NodeJS.Dict<[number, number]>;
16
18
  let styles: {
17
19
  [K in Style]: string
@@ -24,156 +26,101 @@ declare module 'util' {
24
26
  const custom: unique symbol;
25
27
  }
26
28
  /** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
27
- function isArray(object: any): object is any[];
29
+ export function isArray(object: any): object is any[];
28
30
  /** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
29
- function isRegExp(object: any): object is RegExp;
31
+ export function isRegExp(object: any): object is RegExp;
30
32
  /** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
31
- function isDate(object: any): object is Date;
33
+ export function isDate(object: any): object is Date;
32
34
  /** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
33
- function isError(object: any): object is Error;
34
- function inherits(constructor: any, superConstructor: any): void;
35
- function debuglog(key: string): (msg: string, ...param: any[]) => void;
35
+ export function isError(object: any): object is Error;
36
+ export function inherits(constructor: any, superConstructor: any): void;
37
+ export function debuglog(key: string): (msg: string, ...param: any[]) => void;
36
38
  /** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
37
- function isBoolean(object: any): object is boolean;
39
+ export function isBoolean(object: any): object is boolean;
38
40
  /** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
39
- function isBuffer(object: any): object is Buffer;
41
+ export function isBuffer(object: any): object is Buffer;
40
42
  /** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
41
- function isFunction(object: any): boolean;
43
+ export function isFunction(object: any): boolean;
42
44
  /** @deprecated since v4.0.0 - use `value === null` instead. */
43
- function isNull(object: any): object is null;
45
+ export function isNull(object: any): object is null;
44
46
  /** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
45
- function isNullOrUndefined(object: any): object is null | undefined;
47
+ export function isNullOrUndefined(object: any): object is null | undefined;
46
48
  /** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
47
- function isNumber(object: any): object is number;
49
+ export function isNumber(object: any): object is number;
48
50
  /** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
49
- function isObject(object: any): boolean;
51
+ export function isObject(object: any): boolean;
50
52
  /** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
51
- function isPrimitive(object: any): boolean;
53
+ export function isPrimitive(object: any): boolean;
52
54
  /** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
53
- function isString(object: any): object is string;
55
+ export function isString(object: any): object is string;
54
56
  /** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
55
- function isSymbol(object: any): object is symbol;
57
+ export function isSymbol(object: any): object is symbol;
56
58
  /** @deprecated since v4.0.0 - use `value === undefined` instead. */
57
- function isUndefined(object: any): object is undefined;
58
- function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
59
- function isDeepStrictEqual(val1: any, val2: any): boolean;
59
+ export function isUndefined(object: any): object is undefined;
60
+ export function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
61
+ export function isDeepStrictEqual(val1: any, val2: any): boolean;
60
62
 
61
- function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
62
- function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
63
- function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
64
- function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
65
- function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
66
- function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
67
- function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
68
- function callbackify<T1, T2, T3, TResult>(
63
+ export function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
64
+ export function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
65
+ export function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
66
+ export function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
67
+ export function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
68
+ export function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
69
+ export function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
70
+ export function callbackify<T1, T2, T3, TResult>(
69
71
  fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
70
- function callbackify<T1, T2, T3, T4>(
72
+ export function callbackify<T1, T2, T3, T4>(
71
73
  fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
72
- function callbackify<T1, T2, T3, T4, TResult>(
74
+ export function callbackify<T1, T2, T3, T4, TResult>(
73
75
  fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
74
- function callbackify<T1, T2, T3, T4, T5>(
76
+ export function callbackify<T1, T2, T3, T4, T5>(
75
77
  fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
76
- function callbackify<T1, T2, T3, T4, T5, TResult>(
78
+ export function callbackify<T1, T2, T3, T4, T5, TResult>(
77
79
  fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
78
80
  ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
79
- function callbackify<T1, T2, T3, T4, T5, T6>(
81
+ export function callbackify<T1, T2, T3, T4, T5, T6>(
80
82
  fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
81
83
  ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
82
- function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
84
+ export function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
83
85
  fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
84
86
  ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
85
87
 
86
- interface CustomPromisifyLegacy<TCustom extends Function> extends Function {
88
+ export interface CustomPromisifyLegacy<TCustom extends Function> extends Function {
87
89
  __promisify__: TCustom;
88
90
  }
89
91
 
90
- interface CustomPromisifySymbol<TCustom extends Function> extends Function {
92
+ export interface CustomPromisifySymbol<TCustom extends Function> extends Function {
91
93
  [promisify.custom]: TCustom;
92
94
  }
93
95
 
94
- type CustomPromisify<TCustom extends Function> = CustomPromisifySymbol<TCustom> | CustomPromisifyLegacy<TCustom>;
96
+ export type CustomPromisify<TCustom extends Function> = CustomPromisifySymbol<TCustom> | CustomPromisifyLegacy<TCustom>;
95
97
 
96
- function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
97
- function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
98
- function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
99
- function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
100
- function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
101
- function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
102
- function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
103
- function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void):
98
+ export function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
99
+ export function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
100
+ export function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
101
+ export function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
102
+ export function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
103
+ export function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
104
+ export function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
105
+ export function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void):
104
106
  (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
105
- function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
106
- function promisify<T1, T2, T3, T4, TResult>(
107
+ export function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
108
+ export function promisify<T1, T2, T3, T4, TResult>(
107
109
  fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
108
110
  ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
109
- function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void):
111
+ export function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void):
110
112
  (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
111
- function promisify<T1, T2, T3, T4, T5, TResult>(
113
+ export function promisify<T1, T2, T3, T4, T5, TResult>(
112
114
  fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
113
115
  ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
114
- function promisify<T1, T2, T3, T4, T5>(
116
+ export function promisify<T1, T2, T3, T4, T5>(
115
117
  fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
116
118
  ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
117
- function promisify(fn: Function): Function;
118
- namespace promisify {
119
+ export function promisify(fn: Function): Function;
120
+ export namespace promisify {
119
121
  const custom: unique symbol;
120
122
  }
121
-
122
- namespace types {
123
- function isAnyArrayBuffer(object: any): object is ArrayBufferLike;
124
- function isArgumentsObject(object: any): object is IArguments;
125
- function isArrayBuffer(object: any): object is ArrayBuffer;
126
- function isArrayBufferView(object: any): object is NodeJS.ArrayBufferView;
127
- function isAsyncFunction(object: any): boolean;
128
- function isBigInt64Array(value: any): value is BigInt64Array;
129
- function isBigUint64Array(value: any): value is BigUint64Array;
130
- function isBooleanObject(object: any): object is Boolean;
131
- function isBoxedPrimitive(object: any): object is String | Number | BigInt | Boolean | Symbol;
132
- function isDataView(object: any): object is DataView;
133
- function isDate(object: any): object is Date;
134
- function isExternal(object: any): boolean;
135
- function isFloat32Array(object: any): object is Float32Array;
136
- function isFloat64Array(object: any): object is Float64Array;
137
- function isGeneratorFunction(object: any): object is GeneratorFunction;
138
- function isGeneratorObject(object: any): object is Generator;
139
- function isInt8Array(object: any): object is Int8Array;
140
- function isInt16Array(object: any): object is Int16Array;
141
- function isInt32Array(object: any): object is Int32Array;
142
- function isMap<T>(
143
- object: T | {},
144
- ): object is T extends ReadonlyMap<any, any>
145
- ? unknown extends T
146
- ? never
147
- : ReadonlyMap<any, any>
148
- : Map<any, any>;
149
- function isMapIterator(object: any): boolean;
150
- function isModuleNamespaceObject(value: any): boolean;
151
- function isNativeError(object: any): object is Error;
152
- function isNumberObject(object: any): object is Number;
153
- function isPromise(object: any): object is Promise<any>;
154
- function isProxy(object: any): boolean;
155
- function isRegExp(object: any): object is RegExp;
156
- function isSet<T>(
157
- object: T | {},
158
- ): object is T extends ReadonlySet<any>
159
- ? unknown extends T
160
- ? never
161
- : ReadonlySet<any>
162
- : Set<any>;
163
- function isSetIterator(object: any): boolean;
164
- function isSharedArrayBuffer(object: any): object is SharedArrayBuffer;
165
- function isStringObject(object: any): object is String;
166
- function isSymbolObject(object: any): object is Symbol;
167
- function isTypedArray(object: any): object is NodeJS.TypedArray;
168
- function isUint8Array(object: any): object is Uint8Array;
169
- function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
170
- function isUint16Array(object: any): object is Uint16Array;
171
- function isUint32Array(object: any): object is Uint32Array;
172
- function isWeakMap(object: any): object is WeakMap<any, any>;
173
- function isWeakSet(object: any): object is WeakSet<any>;
174
- }
175
-
176
- class TextDecoder {
123
+ export class TextDecoder {
177
124
  readonly encoding: string;
178
125
  readonly fatal: boolean;
179
126
  readonly ignoreBOM: boolean;
@@ -187,7 +134,7 @@ declare module 'util' {
187
134
  ): string;
188
135
  }
189
136
 
190
- interface EncodeIntoResult {
137
+ export interface EncodeIntoResult {
191
138
  /**
192
139
  * The read Unicode code units of input.
193
140
  */
@@ -199,7 +146,9 @@ declare module 'util' {
199
146
  written: number;
200
147
  }
201
148
 
202
- class TextEncoder {
149
+ export { types };
150
+
151
+ export class TextEncoder {
203
152
  readonly encoding: string;
204
153
  encode(input?: string): Uint8Array;
205
154
  encodeInto(input: string, output: Uint8Array): EncodeIntoResult;
node/v8.d.ts CHANGED
@@ -184,4 +184,15 @@ declare module 'v8' {
184
184
  * Uses a `DefaultDeserializer` with default options to read a JS value from a buffer.
185
185
  */
186
186
  function deserialize(data: NodeJS.TypedArray): any;
187
+
188
+ /**
189
+ * Begins writing coverage report based on the `NODE_V8_COVERAGE` env var.
190
+ * Noop is the env var is not set.
191
+ */
192
+ function takeCoverage(): void;
193
+
194
+ /**
195
+ * Stops writing coverage report.
196
+ */
197
+ function stopCoverage(): void;
187
198
  }
node/worker_threads.d.ts CHANGED
@@ -4,6 +4,7 @@ declare module 'worker_threads' {
4
4
  import { Readable, Writable } from 'stream';
5
5
  import { URL } from 'url';
6
6
  import { FileHandle } from 'fs/promises';
7
+ import { EventLoopUtilityFunction } from 'perf_hooks';
7
8
 
8
9
  const isMainThread: boolean;
9
10
  const parentPort: null | MessagePort;
@@ -17,6 +18,10 @@ declare module 'worker_threads' {
17
18
  readonly port2: MessagePort;
18
19
  }
19
20
 
21
+ interface WorkerPerformance {
22
+ eventLoopUtilitzation: EventLoopUtilityFunction;
23
+ }
24
+
20
25
  type TransferListItem = ArrayBuffer | MessagePort | FileHandle;
21
26
 
22
27
  class MessagePort extends EventEmitter {
@@ -119,6 +124,7 @@ declare module 'worker_threads' {
119
124
  readonly stderr: Readable;
120
125
  readonly threadId: number;
121
126
  readonly resourceLimits?: ResourceLimits;
127
+ readonly performance: WorkerPerformance;
122
128
 
123
129
  /**
124
130
  * @param filename The path to the Worker’s main script or module.