@types/node 22.7.1 → 22.7.2

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/stream/web.d.ts CHANGED
@@ -418,7 +418,7 @@ declare module "stream/web" {
418
418
  global {
419
419
  interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {}
420
420
  /**
421
- * `ByteLengthQueuingStrategy` class is a global reference for `require('stream/web').ByteLengthQueuingStrategy`.
421
+ * `ByteLengthQueuingStrategy` class is a global reference for `import { ByteLengthQueuingStrategy } from 'node:stream/web'`.
422
422
  * https://nodejs.org/api/globals.html#class-bytelengthqueuingstrategy
423
423
  * @since v18.0.0
424
424
  */
@@ -428,7 +428,7 @@ declare module "stream/web" {
428
428
 
429
429
  interface CompressionStream extends _CompressionStream {}
430
430
  /**
431
- * `CompressionStream` class is a global reference for `require('stream/web').CompressionStream`.
431
+ * `CompressionStream` class is a global reference for `import { CompressionStream } from 'node:stream/web'`.
432
432
  * https://nodejs.org/api/globals.html#class-compressionstream
433
433
  * @since v18.0.0
434
434
  */
@@ -448,7 +448,7 @@ declare module "stream/web" {
448
448
 
449
449
  interface CountQueuingStrategy extends _CountQueuingStrategy {}
450
450
  /**
451
- * `CountQueuingStrategy` class is a global reference for `require('stream/web').CountQueuingStrategy`.
451
+ * `CountQueuingStrategy` class is a global reference for `import { CountQueuingStrategy } from 'node:stream/web'`.
452
452
  * https://nodejs.org/api/globals.html#class-countqueuingstrategy
453
453
  * @since v18.0.0
454
454
  */
@@ -457,7 +457,7 @@ declare module "stream/web" {
457
457
 
458
458
  interface DecompressionStream extends _DecompressionStream {}
459
459
  /**
460
- * `DecompressionStream` class is a global reference for `require('stream/web').DecompressionStream`.
460
+ * `DecompressionStream` class is a global reference for `import { DecompressionStream } from 'node:stream/web'`.
461
461
  * https://nodejs.org/api/globals.html#class-decompressionstream
462
462
  * @since v18.0.0
463
463
  */
@@ -477,7 +477,7 @@ declare module "stream/web" {
477
477
 
478
478
  interface ReadableByteStreamController extends _ReadableByteStreamController {}
479
479
  /**
480
- * `ReadableByteStreamController` class is a global reference for `require('stream/web').ReadableByteStreamController`.
480
+ * `ReadableByteStreamController` class is a global reference for `import { ReadableByteStreamController } from 'node:stream/web'`.
481
481
  * https://nodejs.org/api/globals.html#class-readablebytestreamcontroller
482
482
  * @since v18.0.0
483
483
  */
@@ -487,7 +487,7 @@ declare module "stream/web" {
487
487
 
488
488
  interface ReadableStream<R = any> extends _ReadableStream<R> {}
489
489
  /**
490
- * `ReadableStream` class is a global reference for `require('stream/web').ReadableStream`.
490
+ * `ReadableStream` class is a global reference for `import { ReadableStream } from 'node:stream/web'`.
491
491
  * https://nodejs.org/api/globals.html#class-readablestream
492
492
  * @since v18.0.0
493
493
  */
@@ -496,7 +496,7 @@ declare module "stream/web" {
496
496
 
497
497
  interface ReadableStreamBYOBReader extends _ReadableStreamBYOBReader {}
498
498
  /**
499
- * `ReadableStreamBYOBReader` class is a global reference for `require('stream/web').ReadableStreamBYOBReader`.
499
+ * `ReadableStreamBYOBReader` class is a global reference for `import { ReadableStreamBYOBReader } from 'node:stream/web'`.
500
500
  * https://nodejs.org/api/globals.html#class-readablestreambyobreader
501
501
  * @since v18.0.0
502
502
  */
@@ -506,7 +506,7 @@ declare module "stream/web" {
506
506
 
507
507
  interface ReadableStreamBYOBRequest extends _ReadableStreamBYOBRequest {}
508
508
  /**
509
- * `ReadableStreamBYOBRequest` class is a global reference for `require('stream/web').ReadableStreamBYOBRequest`.
509
+ * `ReadableStreamBYOBRequest` class is a global reference for `import { ReadableStreamBYOBRequest } from 'node:stream/web'`.
510
510
  * https://nodejs.org/api/globals.html#class-readablestreambyobrequest
511
511
  * @since v18.0.0
512
512
  */
@@ -516,7 +516,7 @@ declare module "stream/web" {
516
516
 
517
517
  interface ReadableStreamDefaultController<R = any> extends _ReadableStreamDefaultController<R> {}
518
518
  /**
519
- * `ReadableStreamDefaultController` class is a global reference for `require('stream/web').ReadableStreamDefaultController`.
519
+ * `ReadableStreamDefaultController` class is a global reference for `import { ReadableStreamDefaultController } from 'node:stream/web'`.
520
520
  * https://nodejs.org/api/globals.html#class-readablestreamdefaultcontroller
521
521
  * @since v18.0.0
522
522
  */
@@ -526,7 +526,7 @@ declare module "stream/web" {
526
526
 
527
527
  interface ReadableStreamDefaultReader<R = any> extends _ReadableStreamDefaultReader<R> {}
528
528
  /**
529
- * `ReadableStreamDefaultReader` class is a global reference for `require('stream/web').ReadableStreamDefaultReader`.
529
+ * `ReadableStreamDefaultReader` class is a global reference for `import { ReadableStreamDefaultReader } from 'node:stream/web'`.
530
530
  * https://nodejs.org/api/globals.html#class-readablestreamdefaultreader
531
531
  * @since v18.0.0
532
532
  */
@@ -536,7 +536,7 @@ declare module "stream/web" {
536
536
 
537
537
  interface TextDecoderStream extends _TextDecoderStream {}
538
538
  /**
539
- * `TextDecoderStream` class is a global reference for `require('stream/web').TextDecoderStream`.
539
+ * `TextDecoderStream` class is a global reference for `import { TextDecoderStream } from 'node:stream/web'`.
540
540
  * https://nodejs.org/api/globals.html#class-textdecoderstream
541
541
  * @since v18.0.0
542
542
  */
@@ -545,7 +545,7 @@ declare module "stream/web" {
545
545
 
546
546
  interface TextEncoderStream extends _TextEncoderStream {}
547
547
  /**
548
- * `TextEncoderStream` class is a global reference for `require('stream/web').TextEncoderStream`.
548
+ * `TextEncoderStream` class is a global reference for `import { TextEncoderStream } from 'node:stream/web'`.
549
549
  * https://nodejs.org/api/globals.html#class-textencoderstream
550
550
  * @since v18.0.0
551
551
  */
@@ -554,7 +554,7 @@ declare module "stream/web" {
554
554
 
555
555
  interface TransformStream<I = any, O = any> extends _TransformStream<I, O> {}
556
556
  /**
557
- * `TransformStream` class is a global reference for `require('stream/web').TransformStream`.
557
+ * `TransformStream` class is a global reference for `import { TransformStream } from 'node:stream/web'`.
558
558
  * https://nodejs.org/api/globals.html#class-transformstream
559
559
  * @since v18.0.0
560
560
  */
@@ -563,7 +563,7 @@ declare module "stream/web" {
563
563
 
564
564
  interface TransformStreamDefaultController<O = any> extends _TransformStreamDefaultController<O> {}
565
565
  /**
566
- * `TransformStreamDefaultController` class is a global reference for `require('stream/web').TransformStreamDefaultController`.
566
+ * `TransformStreamDefaultController` class is a global reference for `import { TransformStreamDefaultController } from 'node:stream/web'`.
567
567
  * https://nodejs.org/api/globals.html#class-transformstreamdefaultcontroller
568
568
  * @since v18.0.0
569
569
  */
@@ -573,7 +573,7 @@ declare module "stream/web" {
573
573
 
574
574
  interface WritableStream<W = any> extends _WritableStream<W> {}
575
575
  /**
576
- * `WritableStream` class is a global reference for `require('stream/web').WritableStream`.
576
+ * `WritableStream` class is a global reference for `import { WritableStream } from 'node:stream/web'`.
577
577
  * https://nodejs.org/api/globals.html#class-writablestream
578
578
  * @since v18.0.0
579
579
  */
@@ -582,7 +582,7 @@ declare module "stream/web" {
582
582
 
583
583
  interface WritableStreamDefaultController extends _WritableStreamDefaultController {}
584
584
  /**
585
- * `WritableStreamDefaultController` class is a global reference for `require('stream/web').WritableStreamDefaultController`.
585
+ * `WritableStreamDefaultController` class is a global reference for `import { WritableStreamDefaultController } from 'node:stream/web'`.
586
586
  * https://nodejs.org/api/globals.html#class-writablestreamdefaultcontroller
587
587
  * @since v18.0.0
588
588
  */
@@ -592,7 +592,7 @@ declare module "stream/web" {
592
592
 
593
593
  interface WritableStreamDefaultWriter<W = any> extends _WritableStreamDefaultWriter<W> {}
594
594
  /**
595
- * `WritableStreamDefaultWriter` class is a global reference for `require('stream/web').WritableStreamDefaultWriter`.
595
+ * `WritableStreamDefaultWriter` class is a global reference for `import { WritableStreamDefaultWriter } from 'node:stream/web'`.
596
596
  * https://nodejs.org/api/globals.html#class-writablestreamdefaultwriter
597
597
  * @since v18.0.0
598
598
  */
node/stream.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * To access the `node:stream` module:
11
11
  *
12
12
  * ```js
13
- * const stream = require('node:stream');
13
+ * import stream from 'node:stream';
14
14
  * ```
15
15
  *
16
16
  * The `node:stream` module is useful for creating new types of stream instances.
@@ -303,7 +303,7 @@ declare module "stream" {
303
303
  * the method does nothing.
304
304
  *
305
305
  * ```js
306
- * const fs = require('node:fs');
306
+ * import fs from 'node:fs';
307
307
  * const readable = getReadableStreamSomehow();
308
308
  * const writable = fs.createWriteStream('file.txt');
309
309
  * // All the data from readable goes into 'file.txt',
@@ -341,7 +341,7 @@ declare module "stream" {
341
341
  * // Pull off a header delimited by \n\n.
342
342
  * // Use unshift() if we get too much.
343
343
  * // Call the callback with (error, header, stream).
344
- * const { StringDecoder } = require('node:string_decoder');
344
+ * import { StringDecoder } from 'node:string_decoder';
345
345
  * function parseHeader(stream, callback) {
346
346
  * stream.on('error', callback);
347
347
  * stream.on('readable', onReadable);
@@ -399,8 +399,8 @@ declare module "stream" {
399
399
  * libraries.
400
400
  *
401
401
  * ```js
402
- * const { OldReader } = require('./old-api-module.js');
403
- * const { Readable } = require('node:stream');
402
+ * import { OldReader } from './old-api-module.js';
403
+ * import { Readable } from 'node:stream';
404
404
  * const oreader = new OldReader();
405
405
  * const myReader = new Readable().wrap(oreader);
406
406
  *
@@ -806,7 +806,7 @@ declare module "stream" {
806
806
  *
807
807
  * ```js
808
808
  * // Write 'hello, ' and then end with 'world!'.
809
- * const fs = require('node:fs');
809
+ * import fs from 'node:fs';
810
810
  * const file = fs.createWriteStream('example.txt');
811
811
  * file.write('hello, ');
812
812
  * file.end('world!');
@@ -1323,7 +1323,7 @@ declare module "stream" {
1323
1323
  * stream, and `controller.error(new AbortError())` for webstreams.
1324
1324
  *
1325
1325
  * ```js
1326
- * const fs = require('node:fs');
1326
+ * import fs from 'node:fs';
1327
1327
  *
1328
1328
  * const controller = new AbortController();
1329
1329
  * const read = addAbortSignal(
@@ -1417,8 +1417,8 @@ declare module "stream" {
1417
1417
  * or has experienced an error or a premature close event.
1418
1418
  *
1419
1419
  * ```js
1420
- * const { finished } = require('node:stream');
1421
- * const fs = require('node:fs');
1420
+ * import { finished } from 'node:stream';
1421
+ * import fs from 'node:fs';
1422
1422
  *
1423
1423
  * const rs = fs.createReadStream('archive.tar');
1424
1424
  *
@@ -1501,9 +1501,9 @@ declare module "stream" {
1501
1501
  * properly cleaning up and provide a callback when the pipeline is complete.
1502
1502
  *
1503
1503
  * ```js
1504
- * const { pipeline } = require('node:stream');
1505
- * const fs = require('node:fs');
1506
- * const zlib = require('node:zlib');
1504
+ * import { pipeline } from 'node:stream';
1505
+ * import fs from 'node:fs';
1506
+ * import zlib from 'node:zlib';
1507
1507
  *
1508
1508
  * // Use the pipeline API to easily pipe a series of streams
1509
1509
  * // together and get notified when the pipeline is fully done.
@@ -1543,9 +1543,9 @@ declare module "stream" {
1543
1543
  * See the example below:
1544
1544
  *
1545
1545
  * ```js
1546
- * const fs = require('node:fs');
1547
- * const http = require('node:http');
1548
- * const { pipeline } = require('node:stream');
1546
+ * import fs from 'node:fs';
1547
+ * import http from 'node:http';
1548
+ * import { pipeline } from 'node:stream';
1549
1549
  *
1550
1550
  * const server = http.createServer((req, res) => {
1551
1551
  * const fileStream = fs.createReadStream('./fileNotExist.txt');
node/string_decoder.d.ts CHANGED
@@ -4,13 +4,13 @@
4
4
  * characters. It can be accessed using:
5
5
  *
6
6
  * ```js
7
- * const { StringDecoder } = require('node:string_decoder');
7
+ * import { StringDecoder } from 'node:string_decoder';
8
8
  * ```
9
9
  *
10
10
  * The following example shows the basic use of the `StringDecoder` class.
11
11
  *
12
12
  * ```js
13
- * const { StringDecoder } = require('node:string_decoder');
13
+ * import { StringDecoder } from 'node:string_decoder';
14
14
  * const decoder = new StringDecoder('utf8');
15
15
  *
16
16
  * const cent = Buffer.from([0xC2, 0xA2]);
@@ -29,7 +29,7 @@
29
29
  * symbol (`€`) are written over three separate operations:
30
30
  *
31
31
  * ```js
32
- * const { StringDecoder } = require('node:string_decoder');
32
+ * import { StringDecoder } from 'node:string_decoder';
33
33
  * const decoder = new StringDecoder('utf8');
34
34
  *
35
35
  * decoder.write(Buffer.from([0xE2]));
node/test.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * work:
11
11
  *
12
12
  * ```js
13
- * import test from 'test';
13
+ * import test from 'node:test';
14
14
  * ```
15
15
  *
16
16
  * Tests created via the `test` module consist of a single function that is
@@ -2029,7 +2029,7 @@ interface TestStdout {
2029
2029
  * work:
2030
2030
  *
2031
2031
  * ```js
2032
- * import test from 'test/reporters';
2032
+ * import test from 'node:test/reporters';
2033
2033
  * ```
2034
2034
  * @since v19.9.0
2035
2035
  * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test/reporters.js)
node/timers/promises.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * The `timers/promises` API provides an alternative set of timer functions
3
- * that return `Promise` objects. The API is accessible via `require('node:timers/promises')`.
3
+ * that return `Promise` objects. The API is accessible via `import timersPromises from 'node:timers/promises'`.
4
4
  *
5
5
  * ```js
6
6
  * import {
7
7
  * setTimeout,
8
8
  * setImmediate,
9
9
  * setInterval,
10
- * } from 'timers/promises';
10
+ * } from 'node:timers/promises';
11
11
  * ```
12
12
  * @since v15.0.0
13
13
  */
@@ -17,7 +17,7 @@ declare module "timers/promises" {
17
17
  * ```js
18
18
  * import {
19
19
  * setTimeout,
20
- * } from 'timers/promises';
20
+ * } from 'node:timers/promises';
21
21
  *
22
22
  * const res = await setTimeout(100, 'result');
23
23
  *
@@ -32,7 +32,7 @@ declare module "timers/promises" {
32
32
  * ```js
33
33
  * import {
34
34
  * setImmediate,
35
- * } from 'timers/promises';
35
+ * } from 'node:timers/promises';
36
36
  *
37
37
  * const res = await setImmediate('result');
38
38
  *
@@ -50,7 +50,7 @@ declare module "timers/promises" {
50
50
  * ```js
51
51
  * import {
52
52
  * setInterval,
53
- * } from 'timers/promises';
53
+ * } from 'node:timers/promises';
54
54
  *
55
55
  * const interval = 100;
56
56
  * for await (const startTime of setInterval(interval, Date.now())) {
node/timers.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The `timer` module exposes a global API for scheduling functions to
3
3
  * be called at some future period of time. Because the timer functions are
4
- * globals, there is no need to call `require('node:timers')` to use the API.
4
+ * globals, there is no need to import `node:timers` to use the API.
5
5
  *
6
6
  * The timer functions within Node.js implement a similar API as the timers API
7
7
  * provided by Web Browsers but use a different internal implementation that is
node/tls.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * The module can be accessed using:
5
5
  *
6
6
  * ```js
7
- * const tls = require('node:tls');
7
+ * import tls from 'node:tls';
8
8
  * ```
9
9
  * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/tls.js)
10
10
  */
@@ -1003,8 +1003,8 @@ declare module "tls" {
1003
1003
  * The following illustrates a simple echo server:
1004
1004
  *
1005
1005
  * ```js
1006
- * const tls = require('node:tls');
1007
- * const fs = require('node:fs');
1006
+ * import tls from 'node:tls';
1007
+ * import fs from 'node:fs';
1008
1008
  *
1009
1009
  * const options = {
1010
1010
  * key: fs.readFileSync('server-key.pem'),
@@ -1049,8 +1049,8 @@ declare module "tls" {
1049
1049
  *
1050
1050
  * ```js
1051
1051
  * // Assumes an echo server that is listening on port 8000.
1052
- * const tls = require('node:tls');
1053
- * const fs = require('node:fs');
1052
+ * import tls from 'node:tls';
1053
+ * import fs from 'node:fs';
1054
1054
  *
1055
1055
  * const options = {
1056
1056
  * // Necessary only if the server requires client certificate authentication.
node/trace_events.d.ts CHANGED
@@ -53,7 +53,7 @@
53
53
  * Alternatively, trace events may be enabled using the `node:trace_events` module:
54
54
  *
55
55
  * ```js
56
- * const trace_events = require('node:trace_events');
56
+ * import trace_events from 'node:trace_events';
57
57
  * const tracing = trace_events.createTracing({ categories: ['node.perf'] });
58
58
  * tracing.enable(); // Enable trace event capture for the 'node.perf' category
59
59
  *
@@ -118,7 +118,7 @@ declare module "trace_events" {
118
118
  * will be disabled.
119
119
  *
120
120
  * ```js
121
- * const trace_events = require('node:trace_events');
121
+ * import trace_events from 'node:trace_events';
122
122
  * const t1 = trace_events.createTracing({ categories: ['node', 'v8'] });
123
123
  * const t2 = trace_events.createTracing({ categories: ['node.perf', 'node'] });
124
124
  * t1.enable();
@@ -159,7 +159,7 @@ declare module "trace_events" {
159
159
  * Creates and returns a `Tracing` object for the given set of `categories`.
160
160
  *
161
161
  * ```js
162
- * const trace_events = require('node:trace_events');
162
+ * import trace_events from 'node:trace_events';
163
163
  * const categories = ['node.perf', 'node.async_hooks'];
164
164
  * const tracing = trace_events.createTracing({ categories });
165
165
  * tracing.enable();
@@ -178,7 +178,7 @@ declare module "trace_events" {
178
178
  * Given the file `test.js` below, the command `node --trace-event-categories node.perf test.js` will print `'node.async_hooks,node.perf'` to the console.
179
179
  *
180
180
  * ```js
181
- * const trace_events = require('node:trace_events');
181
+ * import trace_events from 'node:trace_events';
182
182
  * const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
183
183
  * const t2 = trace_events.createTracing({ categories: ['node.perf'] });
184
184
  * const t3 = trace_events.createTracing({ categories: ['v8'] });
node/tty.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * directly. However, it can be accessed using:
4
4
  *
5
5
  * ```js
6
- * const tty = require('node:tty');
6
+ * import tty from 'node:tty';
7
7
  * ```
8
8
  *
9
9
  * When Node.js detects that it is being run with a text terminal ("TTY")
node/url.d.ts CHANGED
@@ -93,7 +93,7 @@ declare module "url" {
93
93
  * The `url.format()` method returns a formatted URL string derived from `urlObject`.
94
94
  *
95
95
  * ```js
96
- * const url = require('node:url');
96
+ * import url from 'node:url';
97
97
  * url.format({
98
98
  * protocol: 'https',
99
99
  * hostname: 'example.com',
@@ -157,7 +157,7 @@ declare module "url" {
157
157
  * The `url.format()` method returns a formatted URL string derived from `urlObject`.
158
158
  *
159
159
  * ```js
160
- * const url = require('node:url');
160
+ * import url from 'node:url';
161
161
  * url.format({
162
162
  * protocol: 'https',
163
163
  * hostname: 'example.com',
@@ -222,7 +222,7 @@ declare module "url" {
222
222
  * manner similar to that of a web browser resolving an anchor tag.
223
223
  *
224
224
  * ```js
225
- * const url = require('node:url');
225
+ * import url from 'node:url';
226
226
  * url.resolve('/one/two/three', 'four'); // '/one/two/four'
227
227
  * url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
228
228
  * url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
@@ -400,10 +400,10 @@ declare module "url" {
400
400
  * Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later.
401
401
  *
402
402
  * ```js
403
- * const {
403
+ * import {
404
404
  * Blob,
405
405
  * resolveObjectURL,
406
- * } = require('node:buffer');
406
+ * } from 'node:buffer';
407
407
  *
408
408
  * const blob = new Blob(['hello']);
409
409
  * const id = URL.createObjectURL(blob);
@@ -943,7 +943,7 @@ declare module "url" {
943
943
  URLSearchParams: typeof _URLSearchParams;
944
944
  }
945
945
  /**
946
- * `URL` class is a global reference for `require('url').URL`
946
+ * `URL` class is a global reference for `import { URL } from 'url'`
947
947
  * https://nodejs.org/api/url.html#the-whatwg-url-api
948
948
  * @since v10.0.0
949
949
  */
@@ -953,7 +953,7 @@ declare module "url" {
953
953
  } ? T
954
954
  : typeof _URL;
955
955
  /**
956
- * `URLSearchParams` class is a global reference for `require('url').URLSearchParams`
956
+ * `URLSearchParams` class is a global reference for `import { URLSearchParams } from 'node:url'`
957
957
  * https://nodejs.org/api/url.html#class-urlsearchparams
958
958
  * @since v10.0.0
959
959
  */