@types/node 18.7.23 → 18.11.8

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.
@@ -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';
node/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/util.d.ts CHANGED
@@ -162,6 +162,27 @@ declare module 'util' {
162
162
  * @since v16.8.0, v14.18.0
163
163
  */
164
164
  export function toUSVString(string: string): string;
165
+ /**
166
+ * Creates and returns an `AbortController` instance whose `AbortSignal` is marked
167
+ * as transferable and can be used with `structuredClone()` or `postMessage()`.
168
+ * @since v18.11.0
169
+ * @returns A transferable AbortController
170
+ */
171
+ export function transferableAbortController(): AbortController;
172
+ /**
173
+ * Marks the given {AbortSignal} as transferable so that it can be used with
174
+ * `structuredClone()` and `postMessage()`.
175
+ *
176
+ * ```js
177
+ * const signal = transferableAbortSignal(AbortSignal.timeout(100));
178
+ * const channel = new MessageChannel();
179
+ * channel.port2.postMessage(signal, [signal]);
180
+ * ```
181
+ * @since v18.11.0
182
+ * @param signal The AbortSignal
183
+ * @returns The same AbortSignal
184
+ */
185
+ export function transferableAbortSignal(signal: AbortSignal): AbortSignal;
165
186
  /**
166
187
  * The `util.inspect()` method returns a string representation of `object` that is
167
188
  * intended for debugging. The output of `util.inspect` may change at any time
@@ -1067,6 +1088,8 @@ declare module 'util' {
1067
1088
  written: number;
1068
1089
  }
1069
1090
  export { types };
1091
+
1092
+ //// TextEncoder/Decoder
1070
1093
  /**
1071
1094
  * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All
1072
1095
  * instances of `TextEncoder` only support UTF-8 encoding.
@@ -1106,6 +1129,34 @@ declare module 'util' {
1106
1129
  encodeInto(src: string, dest: Uint8Array): EncodeIntoResult;
1107
1130
  }
1108
1131
 
1132
+ import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from 'util';
1133
+ global {
1134
+ /**
1135
+ * `TextDecoder` class is a global reference for `require('util').TextDecoder`
1136
+ * https://nodejs.org/api/globals.html#textdecoder
1137
+ * @since v11.0.0
1138
+ */
1139
+ var TextDecoder: typeof globalThis extends {
1140
+ onmessage: any;
1141
+ TextDecoder: infer TextDecoder;
1142
+ }
1143
+ ? TextDecoder
1144
+ : typeof _TextDecoder;
1145
+
1146
+ /**
1147
+ * `TextEncoder` class is a global reference for `require('util').TextEncoder`
1148
+ * https://nodejs.org/api/globals.html#textencoder
1149
+ * @since v11.0.0
1150
+ */
1151
+ var TextEncoder: typeof globalThis extends {
1152
+ onmessage: any;
1153
+ TextEncoder: infer TextEncoder;
1154
+ }
1155
+ ? TextEncoder
1156
+ : typeof _TextEncoder;
1157
+ }
1158
+
1159
+ //// parseArgs
1109
1160
  /**
1110
1161
  * Provides a high-level API for command-line argument parsing. Takes a
1111
1162
  * specification for the expected arguments and returns a structured object
@@ -1125,6 +1176,9 @@ declare module 'util' {
1125
1176
  * times. If `true`, all values will be collected in an array. If
1126
1177
  * `false`, values for the option are last-wins. **Default:** `false`.
1127
1178
  * - `short` A single character alias for the option.
1179
+ * - `default` The default option value when it is not set by args. It
1180
+ * must be of the same type as the `type` property. When `multiple`
1181
+ * is `true`, it must be an array.
1128
1182
  *
1129
1183
  * - `strict`: Whether an error should be thrown when unknown arguments
1130
1184
  * are encountered, or when arguments are passed that do not match the
@@ -1150,6 +1204,10 @@ declare module 'util' {
1150
1204
  type: 'string' | 'boolean';
1151
1205
  short?: string;
1152
1206
  multiple?: boolean;
1207
+ /**
1208
+ * @since v18.11.0
1209
+ */
1210
+ default?: string | boolean | string[] | boolean[];
1153
1211
  }
1154
1212
 
1155
1213
  interface ParseArgsOptionsConfig {
node/worker_threads.d.ts CHANGED
@@ -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';