@types/node 18.8.2 → 18.8.4

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 (https://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: Tue, 04 Oct 2022 15:32:57 GMT
11
+ * Last updated: Mon, 10 Oct 2022 21:33:31 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/http.d.ts CHANGED
@@ -1541,6 +1541,25 @@ declare module 'http' {
1541
1541
  */
1542
1542
  function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
1543
1543
  function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
1544
+
1545
+ /**
1546
+ * Performs the low-level validations on the provided name that are done when `res.setHeader(name, value)` is called.
1547
+ * Passing illegal value as name will result in a TypeError being thrown, identified by `code: 'ERR_INVALID_HTTP_TOKEN'`.
1548
+ * @param name Header name
1549
+ * @since v14.3.0
1550
+ */
1551
+ function validateHeaderName(name: string): void;
1552
+ /**
1553
+ * Performs the low-level validations on the provided value that are done when `res.setHeader(name, value)` is called.
1554
+ * Passing illegal value as value will result in a TypeError being thrown.
1555
+ * - Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`.
1556
+ * - Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`.
1557
+ * @param name Header name
1558
+ * @param value Header value
1559
+ * @since v14.3.0
1560
+ */
1561
+ function validateHeaderValue(name: string, value: string): void;
1562
+
1544
1563
  let globalAgent: Agent;
1545
1564
  /**
1546
1565
  * Read-only property specifying the maximum allowed size of HTTP headers in bytes.
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.8.2",
3
+ "version": "18.8.4",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -227,6 +227,6 @@
227
227
  },
228
228
  "scripts": {},
229
229
  "dependencies": {},
230
- "typesPublisherContentHash": "034172ea945b66afc6502e6be34d6fb957c596091e39cf43672e8aca563a8c66",
230
+ "typesPublisherContentHash": "c77acbd7196d2ac8a09c9dbff0f75aabaead5468c1cfd9d9db404e7f6989deac",
231
231
  "typeScriptVersion": "4.1"
232
232
  }
node/ts4.8/buffer.d.ts CHANGED
@@ -45,6 +45,7 @@
45
45
  */
46
46
  declare module 'buffer' {
47
47
  import { BinaryLike } from 'node:crypto';
48
+ import { ReadableStream as WebReadableStream } from 'node:stream/web';
48
49
  export const INSPECT_MAX_BYTES: number;
49
50
  export const kMaxLength: number;
50
51
  export const kStringMaxLength: number;
@@ -157,13 +158,15 @@ declare module 'buffer' {
157
158
  */
158
159
  text(): Promise<string>;
159
160
  /**
160
- * Returns a new `ReadableStream` that allows the content of the `Blob` to be read.
161
+ * Returns a new (WHATWG) `ReadableStream` that allows the content of the `Blob` to be read.
161
162
  * @since v16.7.0
162
163
  */
163
- stream(): unknown; // pending web streams types
164
+ stream(): WebReadableStream;
164
165
  }
165
166
  export import atob = globalThis.atob;
166
167
  export import btoa = globalThis.btoa;
168
+
169
+ import { Blob as _Blob } from 'buffer';
167
170
  global {
168
171
  // Buffer class
169
172
  type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
@@ -2231,6 +2234,18 @@ declare module 'buffer' {
2231
2234
  * @param data An ASCII (Latin1) string.
2232
2235
  */
2233
2236
  function btoa(data: string): string;
2237
+
2238
+ /**
2239
+ * `Blob` class is a global reference for `require('node:buffer').Blob`
2240
+ * https://nodejs.org/api/buffer.html#class-blob
2241
+ * @since v18.0.0
2242
+ */
2243
+ var Blob: typeof globalThis extends {
2244
+ onmessage: any;
2245
+ Blob: infer T;
2246
+ }
2247
+ ? T
2248
+ : typeof _Blob;
2234
2249
  }
2235
2250
  }
2236
2251
  declare module 'node:buffer' {
@@ -0,0 +1,126 @@
1
+ export {}; // Don't export anything!
2
+
3
+ //// DOM-like Events
4
+ // NB: The Event / EventTarget / EventListener implementations below were copied
5
+ // from lib.dom.d.ts, then edited to reflect Node's documentation at
6
+ // https://nodejs.org/api/events.html#class-eventtarget.
7
+ // Please read that link to understand important implementation differences.
8
+
9
+ // This conditional type will be the existing global Event in a browser, or
10
+ // the copy below in a Node environment.
11
+ type __Event = typeof globalThis extends { onmessage: any, Event: infer T }
12
+ ? T
13
+ : {
14
+ /** This is not used in Node.js and is provided purely for completeness. */
15
+ readonly bubbles: boolean;
16
+ /** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
17
+ cancelBubble: () => void;
18
+ /** True if the event was created with the cancelable option */
19
+ readonly cancelable: boolean;
20
+ /** This is not used in Node.js and is provided purely for completeness. */
21
+ readonly composed: boolean;
22
+ /** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
23
+ composedPath(): [EventTarget?]
24
+ /** Alias for event.target. */
25
+ readonly currentTarget: EventTarget | null;
26
+ /** Is true if cancelable is true and event.preventDefault() has been called. */
27
+ readonly defaultPrevented: boolean;
28
+ /** This is not used in Node.js and is provided purely for completeness. */
29
+ readonly eventPhase: 0 | 2;
30
+ /** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
31
+ readonly isTrusted: boolean;
32
+ /** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
33
+ preventDefault(): void;
34
+ /** This is not used in Node.js and is provided purely for completeness. */
35
+ returnValue: boolean;
36
+ /** Alias for event.target. */
37
+ readonly srcElement: EventTarget | null;
38
+ /** Stops the invocation of event listeners after the current one completes. */
39
+ stopImmediatePropagation(): void;
40
+ /** This is not used in Node.js and is provided purely for completeness. */
41
+ stopPropagation(): void;
42
+ /** The `EventTarget` dispatching the event */
43
+ readonly target: EventTarget | null;
44
+ /** The millisecond timestamp when the Event object was created. */
45
+ readonly timeStamp: number;
46
+ /** Returns the type of event, e.g. "click", "hashchange", or "submit". */
47
+ readonly type: string;
48
+ };
49
+
50
+ // See comment above explaining conditional type
51
+ type __EventTarget = typeof globalThis extends { onmessage: any, EventTarget: infer T }
52
+ ? T
53
+ : {
54
+ /**
55
+ * Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
56
+ *
57
+ * If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
58
+ *
59
+ * The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
60
+ * Specifically, the `capture` option is used as part of the key when registering a `listener`.
61
+ * Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
62
+ */
63
+ addEventListener(
64
+ type: string,
65
+ listener: EventListener | EventListenerObject,
66
+ options?: AddEventListenerOptions | boolean,
67
+ ): void;
68
+ /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
69
+ dispatchEvent(event: Event): boolean;
70
+ /** Removes the event listener in target's event listener list with the same type, callback, and options. */
71
+ removeEventListener(
72
+ type: string,
73
+ listener: EventListener | EventListenerObject,
74
+ options?: EventListenerOptions | boolean,
75
+ ): void;
76
+ };
77
+
78
+ interface EventInit {
79
+ bubbles?: boolean;
80
+ cancelable?: boolean;
81
+ composed?: boolean;
82
+ }
83
+
84
+ interface EventListenerOptions {
85
+ /** Not directly used by Node.js. Added for API completeness. Default: `false`. */
86
+ capture?: boolean;
87
+ }
88
+
89
+ interface AddEventListenerOptions extends EventListenerOptions {
90
+ /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
91
+ once?: boolean;
92
+ /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
93
+ passive?: boolean;
94
+ }
95
+
96
+ interface EventListener {
97
+ (evt: Event): void;
98
+ }
99
+
100
+ interface EventListenerObject {
101
+ handleEvent(object: Event): void;
102
+ }
103
+
104
+ import {} from 'events'; // Make this an ambient declaration
105
+ declare global {
106
+ /** An event which takes place in the DOM. */
107
+ interface Event extends __Event {}
108
+ var Event: typeof globalThis extends { onmessage: any, Event: infer T }
109
+ ? T
110
+ : {
111
+ prototype: __Event;
112
+ new (type: string, eventInitDict?: EventInit): __Event;
113
+ };
114
+
115
+ /**
116
+ * EventTarget is a DOM interface implemented by objects that can
117
+ * receive events and may have listeners for them.
118
+ */
119
+ interface EventTarget extends __EventTarget {}
120
+ var EventTarget: typeof globalThis extends { onmessage: any, EventTarget: infer T }
121
+ ? T
122
+ : {
123
+ prototype: __EventTarget;
124
+ new (): __EventTarget;
125
+ };
126
+ }
node/ts4.8/events.d.ts CHANGED
@@ -35,16 +35,53 @@
35
35
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/events.js)
36
36
  */
37
37
  declare module 'events' {
38
+ // NOTE: This class is in the docs but is **not actually exported** by Node.
39
+ // If https://github.com/nodejs/node/issues/39903 gets resolved and Node
40
+ // actually starts exporting the class, uncomment below.
41
+
42
+ // import { EventListener, EventListenerObject } from '__dom-events';
43
+ // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */
44
+ // interface NodeEventTarget extends EventTarget {
45
+ // /**
46
+ // * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API.
47
+ // * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget.
48
+ // */
49
+ // addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
50
+ // /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */
51
+ // eventNames(): string[];
52
+ // /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */
53
+ // listenerCount(type: string): number;
54
+ // /** Node.js-specific alias for `eventTarget.removeListener()`. */
55
+ // off(type: string, listener: EventListener | EventListenerObject): this;
56
+ // /** Node.js-specific alias for `eventTarget.addListener()`. */
57
+ // on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
58
+ // /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */
59
+ // once(type: string, listener: EventListener | EventListenerObject): this;
60
+ // /**
61
+ // * Node.js-specific extension to the `EventTarget` class.
62
+ // * If `type` is specified, removes all registered listeners for `type`,
63
+ // * otherwise removes all registered listeners.
64
+ // */
65
+ // removeAllListeners(type: string): this;
66
+ // /**
67
+ // * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`.
68
+ // * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`.
69
+ // */
70
+ // removeListener(type: string, listener: EventListener | EventListenerObject): this;
71
+ // }
72
+
38
73
  interface EventEmitterOptions {
39
74
  /**
40
75
  * Enables automatic capturing of promise rejection.
41
76
  */
42
77
  captureRejections?: boolean | undefined;
43
78
  }
44
- interface NodeEventTarget {
79
+ // Any EventTarget with a Node-style `once` function
80
+ interface _NodeEventTarget {
45
81
  once(eventName: string | symbol, listener: (...args: any[]) => void): this;
46
82
  }
47
- interface DOMEventTarget {
83
+ // Any EventTarget with a DOM-style `addEventListener`
84
+ interface _DOMEventTarget {
48
85
  addEventListener(
49
86
  eventName: string,
50
87
  listener: (...args: any[]) => void,
@@ -154,8 +191,8 @@ declare module 'events' {
154
191
  * ```
155
192
  * @since v11.13.0, v10.16.0
156
193
  */
157
- static once(emitter: NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
158
- static once(emitter: DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
194
+ static once(emitter: _NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
195
+ static once(emitter: _DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
159
196
  /**
160
197
  * ```js
161
198
  * const { on, EventEmitter } = require('events');
@@ -259,7 +296,7 @@ declare module 'events' {
259
296
  * ```
260
297
  * @since v15.2.0, v14.17.0
261
298
  */
262
- static getEventListeners(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
299
+ static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
263
300
  /**
264
301
  * ```js
265
302
  * const {
@@ -277,7 +314,7 @@ declare module 'events' {
277
314
  * @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter}
278
315
  * objects.
279
316
  */
280
- static setMaxListeners(n?: number, ...eventTargets: Array<DOMEventTarget | NodeJS.EventEmitter>): void;
317
+ static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void;
281
318
  /**
282
319
  * This symbol shall be used to install a listener for only monitoring `'error'`
283
320
  * events. Listeners installed using this symbol are called before the regular
node/ts4.8/globals.d.ts CHANGED
@@ -57,7 +57,7 @@ interface AbortController {
57
57
  }
58
58
 
59
59
  /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
60
- interface AbortSignal {
60
+ interface AbortSignal extends EventTarget {
61
61
  /**
62
62
  * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
63
63
  */
node/ts4.8/http.d.ts CHANGED
@@ -1541,6 +1541,25 @@ declare module 'http' {
1541
1541
  */
1542
1542
  function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
1543
1543
  function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
1544
+
1545
+ /**
1546
+ * Performs the low-level validations on the provided name that are done when `res.setHeader(name, value)` is called.
1547
+ * Passing illegal value as name will result in a TypeError being thrown, identified by `code: 'ERR_INVALID_HTTP_TOKEN'`.
1548
+ * @param name Header name
1549
+ * @since v14.3.0
1550
+ */
1551
+ function validateHeaderName(name: string): void;
1552
+ /**
1553
+ * Performs the low-level validations on the provided value that are done when `res.setHeader(name, value)` is called.
1554
+ * Passing illegal value as value will result in a TypeError being thrown.
1555
+ * - Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`.
1556
+ * - Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`.
1557
+ * @param name Header name
1558
+ * @param value Header value
1559
+ * @since v14.3.0
1560
+ */
1561
+ function validateHeaderValue(name: string, value: string): void;
1562
+
1544
1563
  let globalAgent: Agent;
1545
1564
  /**
1546
1565
  * Read-only property specifying the maximum allowed size of HTTP headers in bytes.
node/ts4.8/index.d.ts CHANGED
@@ -47,6 +47,7 @@
47
47
  /// <reference path="dns/promises.d.ts" />
48
48
  /// <reference path="dns/promises.d.ts" />
49
49
  /// <reference path="domain.d.ts" />
50
+ /// <reference path="dom-events.d.ts" />
50
51
  /// <reference path="events.d.ts" />
51
52
  /// <reference path="fs.d.ts" />
52
53
  /// <reference path="fs/promises.d.ts" />
@@ -604,6 +604,21 @@ declare module 'perf_hooks' {
604
604
  * @since v15.9.0, v14.18.0
605
605
  */
606
606
  function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
607
+
608
+ import { performance as _performance } from 'perf_hooks';
609
+ global {
610
+ /**
611
+ * `performance` is a global reference for `require('perf_hooks').performance`
612
+ * https://nodejs.org/api/globals.html#performance
613
+ * @since v16.0.0
614
+ */
615
+ var performance: typeof globalThis extends {
616
+ onmessage: any;
617
+ performance: infer T;
618
+ }
619
+ ? T
620
+ : typeof _performance;
621
+ }
607
622
  }
608
623
  declare module 'node:perf_hooks' {
609
624
  export * from 'perf_hooks';
@@ -1,22 +1,10 @@
1
- // Duplicates of interface in lib.dom.ts.
2
- // Duplicated here rather than referencing lib.dom.ts because doing so causes lib.dom.ts to be loaded for "test-all"
3
- // Which in turn causes tests to pass that shouldn't pass.
4
- //
5
- // This interface is not, and should not be, exported.
6
- interface Blob {
7
- readonly size: number;
8
- readonly type: string;
9
- arrayBuffer(): Promise<ArrayBuffer>;
10
- slice(start?: number, end?: number, contentType?: string): Blob;
11
- stream(): NodeJS.ReadableStream;
12
- text(): Promise<string>;
13
- }
14
1
  declare module 'stream/consumers' {
2
+ import { Blob as NodeBlob } from "node:buffer";
15
3
  import { Readable } from 'node:stream';
16
4
  function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
17
5
  function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
18
6
  function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
19
- function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Blob>;
7
+ function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<NodeBlob>;
20
8
  function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
21
9
  }
22
10
  declare module 'node:stream/consumers' {
node/ts4.8/stream.d.ts CHANGED
@@ -18,6 +18,7 @@
18
18
  */
19
19
  declare module 'stream' {
20
20
  import { EventEmitter, Abortable } from 'node:events';
21
+ import { Blob } from "node:buffer";
21
22
  import * as streamPromises from 'node:stream/promises';
22
23
  import * as streamConsumers from 'node:stream/consumers';
23
24
  import * as streamWeb from 'node:stream/web';
node/ts4.8/url.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/url.js)
9
9
  */
10
10
  declare module 'url' {
11
- import { Blob } from 'node:buffer';
11
+ import { Blob as NodeBlob } from 'node:buffer';
12
12
  import { ClientRequestArgs } from 'node:http';
13
13
  import { ParsedUrlQuery, ParsedUrlQueryInput } from 'node:querystring';
14
14
  // Input to `url.format`
@@ -395,7 +395,7 @@ declare module 'url' {
395
395
  * @since v16.7.0
396
396
  * @experimental
397
397
  */
398
- static createObjectURL(blob: Blob): string;
398
+ static createObjectURL(blob: NodeBlob): string;
399
399
  /**
400
400
  * Removes the stored `Blob` identified by the given ID. Attempting to revoke a
401
401
  * ID that isn’t registered will silently fail.
@@ -875,9 +875,9 @@ declare module 'url' {
875
875
  */
876
876
  var URL: typeof globalThis extends {
877
877
  onmessage: any;
878
- URL: infer URL;
878
+ URL: infer T;
879
879
  }
880
- ? URL
880
+ ? T
881
881
  : typeof _URL;
882
882
  /**
883
883
  * `URLSearchParams` class is a global reference for `require('url').URLSearchParams`
@@ -886,9 +886,9 @@ declare module 'url' {
886
886
  */
887
887
  var URLSearchParams: typeof globalThis extends {
888
888
  onmessage: any;
889
- URLSearchParams: infer URLSearchParams;
889
+ URLSearchParams: infer T;
890
890
  }
891
- ? URLSearchParams
891
+ ? T
892
892
  : typeof _URLSearchParams;
893
893
  }
894
894
  }
node/ts4.8/util.d.ts CHANGED
@@ -1067,6 +1067,8 @@ declare module 'util' {
1067
1067
  written: number;
1068
1068
  }
1069
1069
  export { types };
1070
+
1071
+ //// TextEncoder/Decoder
1070
1072
  /**
1071
1073
  * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All
1072
1074
  * instances of `TextEncoder` only support UTF-8 encoding.
@@ -1106,6 +1108,34 @@ declare module 'util' {
1106
1108
  encodeInto(src: string, dest: Uint8Array): EncodeIntoResult;
1107
1109
  }
1108
1110
 
1111
+ import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from 'util';
1112
+ global {
1113
+ /**
1114
+ * `TextDecoder` class is a global reference for `require('util').TextDecoder`
1115
+ * https://nodejs.org/api/globals.html#textdecoder
1116
+ * @since v11.0.0
1117
+ */
1118
+ var TextDecoder: typeof globalThis extends {
1119
+ onmessage: any;
1120
+ TextDecoder: infer TextDecoder;
1121
+ }
1122
+ ? TextDecoder
1123
+ : typeof _TextDecoder;
1124
+
1125
+ /**
1126
+ * `TextEncoder` class is a global reference for `require('util').TextEncoder`
1127
+ * https://nodejs.org/api/globals.html#textencoder
1128
+ * @since v11.0.0
1129
+ */
1130
+ var TextEncoder: typeof globalThis extends {
1131
+ onmessage: any;
1132
+ TextEncoder: infer TextEncoder;
1133
+ }
1134
+ ? TextEncoder
1135
+ : typeof _TextEncoder;
1136
+ }
1137
+
1138
+ //// parseArgs
1109
1139
  /**
1110
1140
  * Provides a high-level API for command-line argument parsing. Takes a
1111
1141
  * specification for the expected arguments and returns a structured object
@@ -640,6 +640,49 @@ declare module 'worker_threads' {
640
640
  * for the `key` will be deleted.
641
641
  */
642
642
  function setEnvironmentData(key: Serializable, value: Serializable): void;
643
+
644
+ import {
645
+ BroadcastChannel as _BroadcastChannel,
646
+ MessageChannel as _MessageChannel,
647
+ MessagePort as _MessagePort,
648
+ } from 'worker_threads';
649
+ global {
650
+ /**
651
+ * `BroadcastChannel` class is a global reference for `require('worker_threads').BroadcastChannel`
652
+ * https://nodejs.org/api/globals.html#broadcastchannel
653
+ * @since v18.0.0
654
+ */
655
+ var BroadcastChannel: typeof globalThis extends {
656
+ onmessage: any;
657
+ BroadcastChannel: infer T;
658
+ }
659
+ ? T
660
+ : typeof _BroadcastChannel;
661
+
662
+ /**
663
+ * `MessageChannel` class is a global reference for `require('worker_threads').MessageChannel`
664
+ * https://nodejs.org/api/globals.html#messagechannel
665
+ * @since v15.0.0
666
+ */
667
+ var MessageChannel: typeof globalThis extends {
668
+ onmessage: any;
669
+ MessageChannel: infer T;
670
+ }
671
+ ? T
672
+ : typeof _MessageChannel;
673
+
674
+ /**
675
+ * `MessagePort` class is a global reference for `require('worker_threads').MessagePort`
676
+ * https://nodejs.org/api/globals.html#messageport
677
+ * @since v15.0.0
678
+ */
679
+ var MessagePort: typeof globalThis extends {
680
+ onmessage: any;
681
+ MessagePort: infer T;
682
+ }
683
+ ? T
684
+ : typeof _MessagePort;
685
+ }
643
686
  }
644
687
  declare module 'node:worker_threads' {
645
688
  export * from 'worker_threads';