@types/node 20.16.7 → 20.16.9

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 v20.16/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!');
@@ -1304,7 +1304,7 @@ declare module "stream" {
1304
1304
  * stream, and `controller.error(new AbortError())` for webstreams.
1305
1305
  *
1306
1306
  * ```js
1307
- * const fs = require('node:fs');
1307
+ * import fs from 'node:fs';
1308
1308
  *
1309
1309
  * const controller = new AbortController();
1310
1310
  * const read = addAbortSignal(
@@ -1398,8 +1398,8 @@ declare module "stream" {
1398
1398
  * or has experienced an error or a premature close event.
1399
1399
  *
1400
1400
  * ```js
1401
- * const { finished } = require('node:stream');
1402
- * const fs = require('node:fs');
1401
+ * import { finished } from 'node:stream';
1402
+ * import fs from 'node:fs';
1403
1403
  *
1404
1404
  * const rs = fs.createReadStream('archive.tar');
1405
1405
  *
@@ -1482,9 +1482,9 @@ declare module "stream" {
1482
1482
  * properly cleaning up and provide a callback when the pipeline is complete.
1483
1483
  *
1484
1484
  * ```js
1485
- * const { pipeline } = require('node:stream');
1486
- * const fs = require('node:fs');
1487
- * const zlib = require('node:zlib');
1485
+ * import { pipeline } from 'node:stream';
1486
+ * import fs from 'node:fs';
1487
+ * import zlib from 'node:zlib';
1488
1488
  *
1489
1489
  * // Use the pipeline API to easily pipe a series of streams
1490
1490
  * // together and get notified when the pipeline is fully done.
@@ -1524,9 +1524,9 @@ declare module "stream" {
1524
1524
  * See the example below:
1525
1525
  *
1526
1526
  * ```js
1527
- * const fs = require('node:fs');
1528
- * const http = require('node:http');
1529
- * const { pipeline } = require('node:stream');
1527
+ * import fs from 'node:fs';
1528
+ * import http from 'node:http';
1529
+ * import { pipeline } from 'node:stream';
1530
1530
  *
1531
1531
  * const server = http.createServer((req, res) => {
1532
1532
  * const fileStream = fs.createReadStream('./fileNotExist.txt');
@@ -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]));
@@ -1,6 +1,6 @@
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 {
node v20.16/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 v20.16/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/v20.13.1/lib/tls.js)
10
10
  */
@@ -1000,8 +1000,8 @@ declare module "tls" {
1000
1000
  * The following illustrates a simple echo server:
1001
1001
  *
1002
1002
  * ```js
1003
- * const tls = require('node:tls');
1004
- * const fs = require('node:fs');
1003
+ * import tls from 'node:tls';
1004
+ * import fs from 'node:fs';
1005
1005
  *
1006
1006
  * const options = {
1007
1007
  * key: fs.readFileSync('server-key.pem'),
@@ -1046,8 +1046,8 @@ declare module "tls" {
1046
1046
  *
1047
1047
  * ```js
1048
1048
  * // Assumes an echo server that is listening on port 8000.
1049
- * const tls = require('node:tls');
1050
- * const fs = require('node:fs');
1049
+ * import tls from 'node:tls';
1050
+ * import fs from 'node:fs';
1051
1051
  *
1052
1052
  * const options = {
1053
1053
  * // Necessary only if the server requires client certificate authentication.
@@ -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 v20.16/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 v20.16/url.d.ts CHANGED
@@ -85,7 +85,7 @@ declare module "url" {
85
85
  * The `url.format()` method returns a formatted URL string derived from `urlObject`.
86
86
  *
87
87
  * ```js
88
- * const url = require('node:url');
88
+ * import url from 'node:url';
89
89
  * url.format({
90
90
  * protocol: 'https',
91
91
  * hostname: 'example.com',
@@ -149,7 +149,7 @@ declare module "url" {
149
149
  * The `url.format()` method returns a formatted URL string derived from `urlObject`.
150
150
  *
151
151
  * ```js
152
- * const url = require('node:url');
152
+ * import url from 'node:url';
153
153
  * url.format({
154
154
  * protocol: 'https',
155
155
  * hostname: 'example.com',
@@ -214,7 +214,7 @@ declare module "url" {
214
214
  * manner similar to that of a web browser resolving an anchor tag.
215
215
  *
216
216
  * ```js
217
- * const url = require('node:url');
217
+ * import url from 'node:url';
218
218
  * url.resolve('/one/two/three', 'four'); // '/one/two/four'
219
219
  * url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
220
220
  * url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
@@ -392,10 +392,10 @@ declare module "url" {
392
392
  * Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later.
393
393
  *
394
394
  * ```js
395
- * const {
395
+ * import {
396
396
  * Blob,
397
397
  * resolveObjectURL,
398
- * } = require('node:buffer');
398
+ * } from 'node:buffer';
399
399
  *
400
400
  * const blob = new Blob(['hello']);
401
401
  * const id = URL.createObjectURL(blob);
@@ -926,7 +926,7 @@ declare module "url" {
926
926
  URLSearchParams: typeof _URLSearchParams;
927
927
  }
928
928
  /**
929
- * `URL` class is a global reference for `require('url').URL`
929
+ * `URL` class is a global reference for `import { URL } from 'node:url'`
930
930
  * https://nodejs.org/api/url.html#the-whatwg-url-api
931
931
  * @since v10.0.0
932
932
  */
@@ -936,7 +936,7 @@ declare module "url" {
936
936
  } ? T
937
937
  : typeof _URL;
938
938
  /**
939
- * `URLSearchParams` class is a global reference for `require('url').URLSearchParams`
939
+ * `URLSearchParams` class is a global reference for `import { URLSearchParams } from 'node:url'`
940
940
  * https://nodejs.org/api/url.html#class-urlsearchparams
941
941
  * @since v10.0.0
942
942
  */
node v20.16/util.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * it:
5
5
  *
6
6
  * ```js
7
- * const util = require('node:util');
7
+ * import util from 'node:util';
8
8
  * ```
9
9
  * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/util.js)
10
10
  */
@@ -200,7 +200,7 @@ declare module "util" {
200
200
  * timestamp.
201
201
  *
202
202
  * ```js
203
- * const util = require('node:util');
203
+ * import util from 'node:util';
204
204
  *
205
205
  * util.log('Timestamped message.');
206
206
  * ```
@@ -287,7 +287,7 @@ declare module "util" {
287
287
  * Circular references point to their anchor by using a reference index:
288
288
  *
289
289
  * ```js
290
- * const { inspect } = require('node:util');
290
+ * import { inspect } from 'node:util';
291
291
  *
292
292
  * const obj = {};
293
293
  * obj.a = [obj];
@@ -305,7 +305,7 @@ declare module "util" {
305
305
  * The following example inspects all properties of the `util` object:
306
306
  *
307
307
  * ```js
308
- * const util = require('node:util');
308
+ * import util from 'node:util';
309
309
  *
310
310
  * console.log(util.inspect(util, { showHidden: true, depth: null }));
311
311
  * ```
@@ -313,7 +313,7 @@ declare module "util" {
313
313
  * The following example highlights the effect of the `compact` option:
314
314
  *
315
315
  * ```js
316
- * const util = require('node:util');
316
+ * import util from 'node:util';
317
317
  *
318
318
  * const o = {
319
319
  * a: [1, 2, [[
@@ -370,7 +370,7 @@ declare module "util" {
370
370
  * with no remaining strong references may be garbage collected at any time.
371
371
  *
372
372
  * ```js
373
- * const { inspect } = require('node:util');
373
+ * import { inspect } from 'node:util';
374
374
  *
375
375
  * const obj = { a: 1 };
376
376
  * const obj2 = { b: 2 };
@@ -384,8 +384,8 @@ declare module "util" {
384
384
  * impact the result of `util.inspect()`.
385
385
  *
386
386
  * ```js
387
- * const { inspect } = require('node:util');
388
- * const assert = require('node:assert');
387
+ * import { inspect } from 'node:util';
388
+ * import assert from 'node:assert';
389
389
  *
390
390
  * const o1 = {
391
391
  * b: [2, 3, 1],
@@ -412,7 +412,7 @@ declare module "util" {
412
412
  * numbers.
413
413
  *
414
414
  * ```js
415
- * const { inspect } = require('node:util');
415
+ * import { inspect } from 'node:util';
416
416
  *
417
417
  * const thousand = 1_000;
418
418
  * const million = 1_000_000;
@@ -459,7 +459,7 @@ declare module "util" {
459
459
  * Returns `true` if the given `object` is an `Array`. Otherwise, returns `false`.
460
460
  *
461
461
  * ```js
462
- * const util = require('node:util');
462
+ * import util from 'node:util';
463
463
  *
464
464
  * util.isArray([]);
465
465
  * // Returns: true
@@ -476,7 +476,7 @@ declare module "util" {
476
476
  * Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`.
477
477
  *
478
478
  * ```js
479
- * const util = require('node:util');
479
+ * import util from 'node:util';
480
480
  *
481
481
  * util.isRegExp(/some regexp/);
482
482
  * // Returns: true
@@ -493,7 +493,7 @@ declare module "util" {
493
493
  * Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`.
494
494
  *
495
495
  * ```js
496
- * const util = require('node:util');
496
+ * import util from 'node:util';
497
497
  *
498
498
  * util.isDate(new Date());
499
499
  * // Returns: true
@@ -510,7 +510,7 @@ declare module "util" {
510
510
  * Returns `true` if the given `object` is an `Error`. Otherwise, returns `false`.
511
511
  *
512
512
  * ```js
513
- * const util = require('node:util');
513
+ * import util from 'node:util';
514
514
  *
515
515
  * util.isError(new Error());
516
516
  * // Returns: true
@@ -524,7 +524,7 @@ declare module "util" {
524
524
  * possible to obtain an incorrect result when the `object` argument manipulates `@@toStringTag`.
525
525
  *
526
526
  * ```js
527
- * const util = require('node:util');
527
+ * import util from 'node:util';
528
528
  * const obj = { name: 'Error', message: 'an error occurred' };
529
529
  *
530
530
  * util.isError(obj);
@@ -549,8 +549,8 @@ declare module "util" {
549
549
  * through the `constructor.super_` property.
550
550
  *
551
551
  * ```js
552
- * const util = require('node:util');
553
- * const EventEmitter = require('node:events');
552
+ * import util from 'node:util';
553
+ * import EventEmitter from 'node:events';
554
554
  *
555
555
  * function MyStream() {
556
556
  * EventEmitter.call(this);
@@ -576,7 +576,7 @@ declare module "util" {
576
576
  * ES6 example using `class` and `extends`:
577
577
  *
578
578
  * ```js
579
- * const EventEmitter = require('node:events');
579
+ * import EventEmitter from 'node:events';
580
580
  *
581
581
  * class MyStream extends EventEmitter {
582
582
  * write(data) {
@@ -605,7 +605,7 @@ declare module "util" {
605
605
  * environment variable, then the returned function operates similar to `console.error()`. If not, then the returned function is a no-op.
606
606
  *
607
607
  * ```js
608
- * const util = require('node:util');
608
+ * import util from 'node:util';
609
609
  * const debuglog = util.debuglog('foo');
610
610
  *
611
611
  * debuglog('hello from foo [%d]', 123);
@@ -624,7 +624,7 @@ declare module "util" {
624
624
  * The `section` supports wildcard also:
625
625
  *
626
626
  * ```js
627
- * const util = require('node:util');
627
+ * import util from 'node:util';
628
628
  * const debuglog = util.debuglog('foo-bar');
629
629
  *
630
630
  * debuglog('hi there, it\'s foo-bar [%d]', 2333);
@@ -644,7 +644,7 @@ declare module "util" {
644
644
  * unnecessary wrapping.
645
645
  *
646
646
  * ```js
647
- * const util = require('node:util');
647
+ * import util from 'node:util';
648
648
  * let debuglog = util.debuglog('internals', (debug) => {
649
649
  * // Replace with a logging function that optimizes out
650
650
  * // testing if the section is enabled
@@ -662,7 +662,7 @@ declare module "util" {
662
662
  * Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
663
663
  *
664
664
  * ```js
665
- * const util = require('node:util');
665
+ * import util from 'node:util';
666
666
  *
667
667
  * util.isBoolean(1);
668
668
  * // Returns: false
@@ -679,7 +679,7 @@ declare module "util" {
679
679
  * Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`.
680
680
  *
681
681
  * ```js
682
- * const util = require('node:util');
682
+ * import util from 'node:util';
683
683
  *
684
684
  * util.isBuffer({ length: 0 });
685
685
  * // Returns: false
@@ -696,7 +696,7 @@ declare module "util" {
696
696
  * Returns `true` if the given `object` is a `Function`. Otherwise, returns `false`.
697
697
  *
698
698
  * ```js
699
- * const util = require('node:util');
699
+ * import util from 'node:util';
700
700
  *
701
701
  * function Foo() {}
702
702
  * const Bar = () => {};
@@ -716,7 +716,7 @@ declare module "util" {
716
716
  * Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`.
717
717
  *
718
718
  * ```js
719
- * const util = require('node:util');
719
+ * import util from 'node:util';
720
720
  *
721
721
  * util.isNull(0);
722
722
  * // Returns: false
@@ -734,7 +734,7 @@ declare module "util" {
734
734
  * returns `false`.
735
735
  *
736
736
  * ```js
737
- * const util = require('node:util');
737
+ * import util from 'node:util';
738
738
  *
739
739
  * util.isNullOrUndefined(0);
740
740
  * // Returns: false
@@ -751,7 +751,7 @@ declare module "util" {
751
751
  * Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.
752
752
  *
753
753
  * ```js
754
- * const util = require('node:util');
754
+ * import util from 'node:util';
755
755
  *
756
756
  * util.isNumber(false);
757
757
  * // Returns: false
@@ -771,7 +771,7 @@ declare module "util" {
771
771
  * Otherwise, returns `false`.
772
772
  *
773
773
  * ```js
774
- * const util = require('node:util');
774
+ * import util from 'node:util';
775
775
  *
776
776
  * util.isObject(5);
777
777
  * // Returns: false
@@ -790,7 +790,7 @@ declare module "util" {
790
790
  * Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`.
791
791
  *
792
792
  * ```js
793
- * const util = require('node:util');
793
+ * import util from 'node:util';
794
794
  *
795
795
  * util.isPrimitive(5);
796
796
  * // Returns: true
@@ -819,7 +819,7 @@ declare module "util" {
819
819
  * Returns `true` if the given `object` is a `string`. Otherwise, returns `false`.
820
820
  *
821
821
  * ```js
822
- * const util = require('node:util');
822
+ * import util from 'node:util';
823
823
  *
824
824
  * util.isString('');
825
825
  * // Returns: true
@@ -838,7 +838,7 @@ declare module "util" {
838
838
  * Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`.
839
839
  *
840
840
  * ```js
841
- * const util = require('node:util');
841
+ * import util from 'node:util';
842
842
  *
843
843
  * util.isSymbol(5);
844
844
  * // Returns: false
@@ -855,7 +855,7 @@ declare module "util" {
855
855
  * Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`.
856
856
  *
857
857
  * ```js
858
- * const util = require('node:util');
858
+ * import util from 'node:util';
859
859
  *
860
860
  * const foo = undefined;
861
861
  * util.isUndefined(5);
@@ -874,7 +874,7 @@ declare module "util" {
874
874
  * such a way that it is marked as deprecated.
875
875
  *
876
876
  * ```js
877
- * const util = require('node:util');
877
+ * import util from 'node:util';
878
878
  *
879
879
  * exports.obsoleteFunction = util.deprecate(() => {
880
880
  * // Do something here.
@@ -890,7 +890,7 @@ declare module "util" {
890
890
  * the warning will be emitted only once for that `code`.
891
891
  *
892
892
  * ```js
893
- * const util = require('node:util');
893
+ * import util from 'node:util';
894
894
  *
895
895
  * const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001');
896
896
  * const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001');
@@ -944,7 +944,7 @@ declare module "util" {
944
944
  * first argument will be the rejection reason (or `null` if the `Promise` resolved), and the second argument will be the resolved value.
945
945
  *
946
946
  * ```js
947
- * const util = require('node:util');
947
+ * import util from 'node:util';
948
948
  *
949
949
  * async function fn() {
950
950
  * return 'hello world';
@@ -1070,8 +1070,8 @@ declare module "util" {
1070
1070
  * that returns promises.
1071
1071
  *
1072
1072
  * ```js
1073
- * const util = require('node:util');
1074
- * const fs = require('node:fs');
1073
+ * import util from 'node:util';
1074
+ * import fs from 'node:fs';
1075
1075
  *
1076
1076
  * const stat = util.promisify(fs.stat);
1077
1077
  * stat('.').then((stats) => {
@@ -1084,8 +1084,8 @@ declare module "util" {
1084
1084
  * Or, equivalently using `async function`s:
1085
1085
  *
1086
1086
  * ```js
1087
- * const util = require('node:util');
1088
- * const fs = require('node:fs');
1087
+ * import util from 'node:util';
1088
+ * import fs from 'node:fs';
1089
1089
  *
1090
1090
  * const stat = util.promisify(fs.stat);
1091
1091
  *
@@ -1108,7 +1108,7 @@ declare module "util" {
1108
1108
  * work as expected unless handled specially:
1109
1109
  *
1110
1110
  * ```js
1111
- * const util = require('node:util');
1111
+ * import util from 'node:util';
1112
1112
  *
1113
1113
  * class Foo {
1114
1114
  * constructor() {
@@ -1178,7 +1178,7 @@ declare module "util" {
1178
1178
  * Given an example `.env` file:
1179
1179
  *
1180
1180
  * ```js
1181
- * const { parseEnv } = require('node:util');
1181
+ * import { parseEnv } from 'node:util';
1182
1182
  *
1183
1183
  * parseEnv('HELLO=world\nHELLO=oh my\n');
1184
1184
  * // Returns: { HELLO: 'oh my' }
@@ -1247,7 +1247,7 @@ declare module "util" {
1247
1247
  * This function returns a formatted text considering the `format` passed.
1248
1248
  *
1249
1249
  * ```js
1250
- * const { styleText } = require('node:util');
1250
+ * import { styleText } from 'node:util';
1251
1251
  * const errorMessage = styleText('red', 'Error! Error!');
1252
1252
  * console.log(errorMessage);
1253
1253
  * ```
@@ -1383,7 +1383,7 @@ declare module "util" {
1383
1383
  import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from "util";
1384
1384
  global {
1385
1385
  /**
1386
- * `TextDecoder` class is a global reference for `require('util').TextDecoder`
1386
+ * `TextDecoder` class is a global reference for `import { TextDecoder } from 'node:util'`
1387
1387
  * https://nodejs.org/api/globals.html#textdecoder
1388
1388
  * @since v11.0.0
1389
1389
  */
@@ -1393,7 +1393,7 @@ declare module "util" {
1393
1393
  } ? TextDecoder
1394
1394
  : typeof _TextDecoder;
1395
1395
  /**
1396
- * `TextEncoder` class is a global reference for `require('util').TextEncoder`
1396
+ * `TextEncoder` class is a global reference for `import { TextEncoder } from 'node:util'`
1397
1397
  * https://nodejs.org/api/globals.html#textencoder
1398
1398
  * @since v11.0.0
1399
1399
  */
@@ -1934,7 +1934,7 @@ declare module "util/types" {
1934
1934
  * ```
1935
1935
  *
1936
1936
  * ```js
1937
- * const native = require('napi_addon.node');
1937
+ * const native =require('napi_addon.node');
1938
1938
  * const data = native.myNapi();
1939
1939
  * util.types.isExternal(data); // returns true
1940
1940
  * util.types.isExternal(0); // returns false
@@ -2084,7 +2084,7 @@ declare module "util/types" {
2084
2084
  * which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false` for these errors:
2085
2085
  *
2086
2086
  * ```js
2087
- * const vm = require('node:vm');
2087
+ * import vm from 'node:vm';
2088
2088
  * const context = vm.createContext({});
2089
2089
  * const myError = vm.runInContext('new Error()', context);
2090
2090
  * console.log(util.types.isNativeError(myError)); // true