@types/node 18.16.2 → 20.0.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.
Files changed (95) hide show
  1. node/README.md +1 -1
  2. node/assert.d.ts +68 -73
  3. node/async_hooks.d.ts +62 -42
  4. node/buffer.d.ts +123 -95
  5. node/child_process.d.ts +50 -54
  6. node/cluster.d.ts +12 -12
  7. node/console.d.ts +5 -5
  8. node/crypto.d.ts +209 -220
  9. node/dgram.d.ts +15 -15
  10. node/diagnostics_channel.d.ts +25 -26
  11. node/dns/promises.d.ts +6 -6
  12. node/dns.d.ts +16 -16
  13. node/domain.d.ts +3 -3
  14. node/events.d.ts +60 -60
  15. node/fs/promises.d.ts +74 -48
  16. node/fs.d.ts +91 -81
  17. node/http.d.ts +147 -144
  18. node/http2.d.ts +42 -46
  19. node/https.d.ts +52 -153
  20. node/index.d.ts +1 -1
  21. node/inspector.d.ts +10 -3
  22. node/module.d.ts +5 -4
  23. node/net.d.ts +21 -18
  24. node/os.d.ts +22 -18
  25. node/package.json +2 -2
  26. node/path.d.ts +4 -4
  27. node/perf_hooks.d.ts +28 -15
  28. node/process.d.ts +43 -46
  29. node/punycode.d.ts +1 -1
  30. node/querystring.d.ts +5 -5
  31. node/readline/promises.d.ts +6 -4
  32. node/readline.d.ts +15 -15
  33. node/repl.d.ts +9 -9
  34. node/stream/consumers.d.ts +1 -1
  35. node/stream.d.ts +74 -136
  36. node/string_decoder.d.ts +6 -6
  37. node/test.d.ts +0 -76
  38. node/timers/promises.d.ts +3 -3
  39. node/timers.d.ts +2 -2
  40. node/tls.d.ts +29 -15
  41. node/trace_events.d.ts +20 -9
  42. node/ts4.8/assert.d.ts +68 -73
  43. node/ts4.8/async_hooks.d.ts +59 -31
  44. node/ts4.8/buffer.d.ts +123 -95
  45. node/ts4.8/child_process.d.ts +50 -54
  46. node/ts4.8/cluster.d.ts +12 -12
  47. node/ts4.8/console.d.ts +5 -5
  48. node/ts4.8/crypto.d.ts +209 -220
  49. node/ts4.8/dgram.d.ts +15 -15
  50. node/ts4.8/diagnostics_channel.d.ts +25 -26
  51. node/ts4.8/dns/promises.d.ts +6 -6
  52. node/ts4.8/dns.d.ts +16 -16
  53. node/ts4.8/domain.d.ts +3 -3
  54. node/ts4.8/events.d.ts +60 -60
  55. node/ts4.8/fs/promises.d.ts +72 -45
  56. node/ts4.8/fs.d.ts +81 -67
  57. node/ts4.8/http.d.ts +133 -126
  58. node/ts4.8/http2.d.ts +42 -46
  59. node/ts4.8/https.d.ts +52 -153
  60. node/ts4.8/inspector.d.ts +10 -3
  61. node/ts4.8/module.d.ts +5 -4
  62. node/ts4.8/net.d.ts +21 -18
  63. node/ts4.8/os.d.ts +22 -18
  64. node/ts4.8/path.d.ts +4 -4
  65. node/ts4.8/perf_hooks.d.ts +28 -15
  66. node/ts4.8/process.d.ts +43 -46
  67. node/ts4.8/punycode.d.ts +1 -1
  68. node/ts4.8/querystring.d.ts +5 -5
  69. node/ts4.8/readline/promises.d.ts +6 -4
  70. node/ts4.8/readline.d.ts +15 -15
  71. node/ts4.8/repl.d.ts +9 -9
  72. node/ts4.8/stream/consumers.d.ts +1 -1
  73. node/ts4.8/stream.d.ts +77 -139
  74. node/ts4.8/string_decoder.d.ts +6 -6
  75. node/ts4.8/test.d.ts +0 -75
  76. node/ts4.8/timers/promises.d.ts +3 -3
  77. node/ts4.8/timers.d.ts +2 -2
  78. node/ts4.8/tls.d.ts +29 -15
  79. node/ts4.8/trace_events.d.ts +20 -9
  80. node/ts4.8/tty.d.ts +4 -5
  81. node/ts4.8/url.d.ts +26 -36
  82. node/ts4.8/util.d.ts +143 -116
  83. node/ts4.8/v8.d.ts +107 -16
  84. node/ts4.8/vm.d.ts +292 -42
  85. node/ts4.8/wasi.d.ts +8 -14
  86. node/ts4.8/worker_threads.d.ts +32 -34
  87. node/ts4.8/zlib.d.ts +11 -11
  88. node/tty.d.ts +4 -5
  89. node/url.d.ts +26 -36
  90. node/util.d.ts +146 -111
  91. node/v8.d.ts +110 -16
  92. node/vm.d.ts +292 -42
  93. node/wasi.d.ts +8 -14
  94. node/worker_threads.d.ts +32 -34
  95. node/zlib.d.ts +11 -11
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: Thu, 27 Apr 2023 21:32:47 GMT
11
+ * Last updated: Fri, 05 May 2023 07:02:50 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/assert.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * The `assert` module provides a set of assertion functions for verifying
2
+ * The `node:assert` module provides a set of assertion functions for verifying
3
3
  * invariants.
4
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/assert.js)
4
+ * @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/assert.js)
5
5
  */
6
6
  declare module 'assert' {
7
7
  /**
@@ -12,8 +12,7 @@ declare module 'assert' {
12
12
  function assert(value: unknown, message?: string | Error): asserts value;
13
13
  namespace assert {
14
14
  /**
15
- * Indicates the failure of an assertion. All errors thrown by the `assert` module
16
- * will be instances of the `AssertionError` class.
15
+ * Indicates the failure of an assertion. All errors thrown by the `node:assert`module will be instances of the `AssertionError` class.
17
16
  */
18
17
  class AssertionError extends Error {
19
18
  actual: unknown;
@@ -47,7 +46,7 @@ declare module 'assert' {
47
46
  * error.
48
47
  *
49
48
  * ```js
50
- * import assert from 'assert';
49
+ * import assert from 'node:assert';
51
50
  *
52
51
  * // Creates call tracker.
53
52
  * const tracker = new assert.CallTracker();
@@ -78,12 +77,11 @@ declare module 'assert' {
78
77
  * callsfunc(1, 2, 3);
79
78
  *
80
79
  * assert.deepStrictEqual(tracker.getCalls(callsfunc),
81
- * [{ thisArg: this, arguments: [1, 2, 3 ] }]);
80
+ * [{ thisArg: undefined, arguments: [1, 2, 3] }]);
82
81
  * ```
83
- *
84
82
  * @since v18.8.0, v16.18.0
85
- * @params fn
86
- * @returns An Array with the calls to a tracked function.
83
+ * @param fn
84
+ * @return An Array with all the calls to a tracked function.
87
85
  */
88
86
  getCalls(fn: Function): CallTrackerCall[];
89
87
  /**
@@ -91,21 +89,19 @@ declare module 'assert' {
91
89
  * the functions that have not been called the expected number of times.
92
90
  *
93
91
  * ```js
94
- * import assert from 'assert';
92
+ * import assert from 'node:assert';
95
93
  *
96
94
  * // Creates call tracker.
97
95
  * const tracker = new assert.CallTracker();
98
96
  *
99
97
  * function func() {}
100
98
  *
101
- * function foo() {}
102
- *
103
99
  * // Returns a function that wraps func() that must be called exact times
104
100
  * // before tracker.verify().
105
101
  * const callsfunc = tracker.calls(func, 2);
106
102
  *
107
103
  * // Returns an array containing information on callsfunc()
108
- * tracker.report();
104
+ * console.log(tracker.report());
109
105
  * // [
110
106
  * // {
111
107
  * // message: 'Expected the func function to be executed 2 time(s) but was
@@ -118,7 +114,7 @@ declare module 'assert' {
118
114
  * // ]
119
115
  * ```
120
116
  * @since v14.2.0, v12.19.0
121
- * @return of objects containing information about the wrapper functions returned by `calls`.
117
+ * @return An Array of objects containing information about the wrapper functions returned by `calls`.
122
118
  */
123
119
  report(): CallTrackerReportInformation[];
124
120
  /**
@@ -136,12 +132,11 @@ declare module 'assert' {
136
132
  *
137
133
  * callsfunc();
138
134
  * // Tracker was called once
139
- * tracker.getCalls(callsfunc).length === 1;
135
+ * assert.strictEqual(tracker.getCalls(callsfunc).length, 1);
140
136
  *
141
137
  * tracker.reset(callsfunc);
142
- * tracker.getCalls(callsfunc).length === 0;
138
+ * assert.strictEqual(tracker.getCalls(callsfunc).length, 0);
143
139
  * ```
144
- *
145
140
  * @since v18.8.0, v16.18.0
146
141
  * @param fn a tracked function to reset.
147
142
  */
@@ -151,7 +146,7 @@ declare module 'assert' {
151
146
  * have not been called the expected number of times.
152
147
  *
153
148
  * ```js
154
- * import assert from 'assert';
149
+ * import assert from 'node:assert';
155
150
  *
156
151
  * // Creates call tracker.
157
152
  * const tracker = new assert.CallTracker();
@@ -193,7 +188,7 @@ declare module 'assert' {
193
188
  * it will be thrown instead of the `AssertionError`.
194
189
  *
195
190
  * ```js
196
- * import assert from 'assert/strict';
191
+ * import assert from 'node:assert/strict';
197
192
  *
198
193
  * assert.fail();
199
194
  * // AssertionError [ERR_ASSERTION]: Failed
@@ -231,7 +226,7 @@ declare module 'assert' {
231
226
  * thrown in a file! See below for further details.
232
227
  *
233
228
  * ```js
234
- * import assert from 'assert/strict';
229
+ * import assert from 'node:assert/strict';
235
230
  *
236
231
  * assert.ok(true);
237
232
  * // OK
@@ -266,7 +261,7 @@ declare module 'assert' {
266
261
  * ```
267
262
  *
268
263
  * ```js
269
- * import assert from 'assert/strict';
264
+ * import assert from 'node:assert/strict';
270
265
  *
271
266
  * // Using `assert()` works the same:
272
267
  * assert(0);
@@ -291,7 +286,7 @@ declare module 'assert' {
291
286
  * and treated as being identical if both sides are `NaN`.
292
287
  *
293
288
  * ```js
294
- * import assert from 'assert';
289
+ * import assert from 'node:assert';
295
290
  *
296
291
  * assert.equal(1, 1);
297
292
  * // OK, 1 == 1
@@ -324,7 +319,7 @@ declare module 'assert' {
324
319
  * specially handled and treated as being identical if both sides are `NaN`.
325
320
  *
326
321
  * ```js
327
- * import assert from 'assert';
322
+ * import assert from 'node:assert';
328
323
  *
329
324
  * assert.notEqual(1, 2);
330
325
  * // OK
@@ -371,24 +366,24 @@ declare module 'assert' {
371
366
  * Tests for any deep inequality. Opposite of {@link deepEqual}.
372
367
  *
373
368
  * ```js
374
- * import assert from 'assert';
369
+ * import assert from 'node:assert';
375
370
  *
376
371
  * const obj1 = {
377
372
  * a: {
378
- * b: 1
379
- * }
373
+ * b: 1,
374
+ * },
380
375
  * };
381
376
  * const obj2 = {
382
377
  * a: {
383
- * b: 2
384
- * }
378
+ * b: 2,
379
+ * },
385
380
  * };
386
381
  * const obj3 = {
387
382
  * a: {
388
- * b: 1
389
- * }
383
+ * b: 1,
384
+ * },
390
385
  * };
391
- * const obj4 = Object.create(obj1);
386
+ * const obj4 = { __proto__: obj1 };
392
387
  *
393
388
  * assert.notDeepEqual(obj1, obj1);
394
389
  * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
@@ -414,7 +409,7 @@ declare module 'assert' {
414
409
  * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
415
410
  *
416
411
  * ```js
417
- * import assert from 'assert/strict';
412
+ * import assert from 'node:assert/strict';
418
413
  *
419
414
  * assert.strictEqual(1, 2);
420
415
  * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
@@ -452,7 +447,7 @@ declare module 'assert' {
452
447
  * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
453
448
  *
454
449
  * ```js
455
- * import assert from 'assert/strict';
450
+ * import assert from 'node:assert/strict';
456
451
  *
457
452
  * assert.notStrictEqual(1, 2);
458
453
  * // OK
@@ -483,7 +478,7 @@ declare module 'assert' {
483
478
  * Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
484
479
  *
485
480
  * ```js
486
- * import assert from 'assert/strict';
481
+ * import assert from 'node:assert/strict';
487
482
  *
488
483
  * assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
489
484
  * // OK
@@ -514,14 +509,14 @@ declare module 'assert' {
514
509
  * Custom validation object/error instance:
515
510
  *
516
511
  * ```js
517
- * import assert from 'assert/strict';
512
+ * import assert from 'node:assert/strict';
518
513
  *
519
514
  * const err = new TypeError('Wrong value');
520
515
  * err.code = 404;
521
516
  * err.foo = 'bar';
522
517
  * err.info = {
523
518
  * nested: true,
524
- * baz: 'text'
519
+ * baz: 'text',
525
520
  * };
526
521
  * err.reg = /abc/i;
527
522
  *
@@ -534,16 +529,16 @@ declare module 'assert' {
534
529
  * message: 'Wrong value',
535
530
  * info: {
536
531
  * nested: true,
537
- * baz: 'text'
538
- * }
532
+ * baz: 'text',
533
+ * },
539
534
  * // Only properties on the validation object will be tested for.
540
535
  * // Using nested objects requires all properties to be present. Otherwise
541
536
  * // the validation is going to fail.
542
- * }
537
+ * },
543
538
  * );
544
539
  *
545
540
  * // Using regular expressions to validate error properties:
546
- * throws(
541
+ * assert.throws(
547
542
  * () => {
548
543
  * throw err;
549
544
  * },
@@ -557,17 +552,17 @@ declare module 'assert' {
557
552
  * info: {
558
553
  * nested: true,
559
554
  * // It is not possible to use regular expressions for nested properties!
560
- * baz: 'text'
555
+ * baz: 'text',
561
556
  * },
562
557
  * // The `reg` property contains a regular expression and only if the
563
558
  * // validation object contains an identical regular expression, it is going
564
559
  * // to pass.
565
- * reg: /abc/i
566
- * }
560
+ * reg: /abc/i,
561
+ * },
567
562
  * );
568
563
  *
569
564
  * // Fails due to the different `message` and `name` properties:
570
- * throws(
565
+ * assert.throws(
571
566
  * () => {
572
567
  * const otherErr = new Error('Not found');
573
568
  * // Copy all enumerable properties from `err` to `otherErr`.
@@ -578,20 +573,20 @@ declare module 'assert' {
578
573
  * },
579
574
  * // The error's `message` and `name` properties will also be checked when using
580
575
  * // an error as validation object.
581
- * err
576
+ * err,
582
577
  * );
583
578
  * ```
584
579
  *
585
580
  * Validate instanceof using constructor:
586
581
  *
587
582
  * ```js
588
- * import assert from 'assert/strict';
583
+ * import assert from 'node:assert/strict';
589
584
  *
590
585
  * assert.throws(
591
586
  * () => {
592
587
  * throw new Error('Wrong value');
593
588
  * },
594
- * Error
589
+ * Error,
595
590
  * );
596
591
  * ```
597
592
  *
@@ -601,13 +596,13 @@ declare module 'assert' {
601
596
  * therefore also include the error name.
602
597
  *
603
598
  * ```js
604
- * import assert from 'assert/strict';
599
+ * import assert from 'node:assert/strict';
605
600
  *
606
601
  * assert.throws(
607
602
  * () => {
608
603
  * throw new Error('Wrong value');
609
604
  * },
610
- * /^Error: Wrong value$/
605
+ * /^Error: Wrong value$/,
611
606
  * );
612
607
  * ```
613
608
  *
@@ -617,7 +612,7 @@ declare module 'assert' {
617
612
  * It will otherwise fail with an `AssertionError`.
618
613
  *
619
614
  * ```js
620
- * import assert from 'assert/strict';
615
+ * import assert from 'node:assert/strict';
621
616
  *
622
617
  * assert.throws(
623
618
  * () => {
@@ -633,7 +628,7 @@ declare module 'assert' {
633
628
  * // possible.
634
629
  * return true;
635
630
  * },
636
- * 'unexpected error'
631
+ * 'unexpected error',
637
632
  * );
638
633
  * ```
639
634
  *
@@ -643,7 +638,7 @@ declare module 'assert' {
643
638
  * a string as the second argument gets considered:
644
639
  *
645
640
  * ```js
646
- * import assert from 'assert/strict';
641
+ * import assert from 'node:assert/strict';
647
642
  *
648
643
  * function throwingFirst() {
649
644
  * throw new Error('First');
@@ -699,20 +694,20 @@ declare module 'assert' {
699
694
  * propagated back to the caller.
700
695
  *
701
696
  * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
702
- * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
697
+ * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
703
698
  * function. See {@link throws} for more details.
704
699
  *
705
700
  * The following, for instance, will throw the `TypeError` because there is no
706
701
  * matching error type in the assertion:
707
702
  *
708
703
  * ```js
709
- * import assert from 'assert/strict';
704
+ * import assert from 'node:assert/strict';
710
705
  *
711
706
  * assert.doesNotThrow(
712
707
  * () => {
713
708
  * throw new TypeError('Wrong value');
714
709
  * },
715
- * SyntaxError
710
+ * SyntaxError,
716
711
  * );
717
712
  * ```
718
713
  *
@@ -720,27 +715,27 @@ declare module 'assert' {
720
715
  * 'Got unwanted exception...':
721
716
  *
722
717
  * ```js
723
- * import assert from 'assert/strict';
718
+ * import assert from 'node:assert/strict';
724
719
  *
725
720
  * assert.doesNotThrow(
726
721
  * () => {
727
722
  * throw new TypeError('Wrong value');
728
723
  * },
729
- * TypeError
724
+ * TypeError,
730
725
  * );
731
726
  * ```
732
727
  *
733
728
  * If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
734
729
  *
735
730
  * ```js
736
- * import assert from 'assert/strict';
731
+ * import assert from 'node:assert/strict';
737
732
  *
738
733
  * assert.doesNotThrow(
739
734
  * () => {
740
735
  * throw new TypeError('Wrong value');
741
736
  * },
742
737
  * /Wrong value/,
743
- * 'Whoops'
738
+ * 'Whoops',
744
739
  * );
745
740
  * // Throws: AssertionError: Got unwanted exception: Whoops
746
741
  * ```
@@ -754,7 +749,7 @@ declare module 'assert' {
754
749
  * from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
755
750
  *
756
751
  * ```js
757
- * import assert from 'assert/strict';
752
+ * import assert from 'node:assert/strict';
758
753
  *
759
754
  * assert.ifError(null);
760
755
  * // OK
@@ -800,7 +795,7 @@ declare module 'assert' {
800
795
  * If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
801
796
  *
802
797
  * ```js
803
- * import assert from 'assert/strict';
798
+ * import assert from 'node:assert/strict';
804
799
  *
805
800
  * await assert.rejects(
806
801
  * async () => {
@@ -808,13 +803,13 @@ declare module 'assert' {
808
803
  * },
809
804
  * {
810
805
  * name: 'TypeError',
811
- * message: 'Wrong value'
812
- * }
806
+ * message: 'Wrong value',
807
+ * },
813
808
  * );
814
809
  * ```
815
810
  *
816
811
  * ```js
817
- * import assert from 'assert/strict';
812
+ * import assert from 'node:assert/strict';
818
813
  *
819
814
  * await assert.rejects(
820
815
  * async () => {
@@ -824,16 +819,16 @@ declare module 'assert' {
824
819
  * assert.strictEqual(err.name, 'TypeError');
825
820
  * assert.strictEqual(err.message, 'Wrong value');
826
821
  * return true;
827
- * }
822
+ * },
828
823
  * );
829
824
  * ```
830
825
  *
831
826
  * ```js
832
- * import assert from 'assert/strict';
827
+ * import assert from 'node:assert/strict';
833
828
  *
834
829
  * assert.rejects(
835
830
  * Promise.reject(new Error('Wrong value')),
836
- * Error
831
+ * Error,
837
832
  * ).then(() => {
838
833
  * // ...
839
834
  * });
@@ -863,24 +858,24 @@ declare module 'assert' {
863
858
  * error messages as expressive as possible.
864
859
  *
865
860
  * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
866
- * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
861
+ * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
867
862
  * function. See {@link throws} for more details.
868
863
  *
869
864
  * Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
870
865
  *
871
866
  * ```js
872
- * import assert from 'assert/strict';
867
+ * import assert from 'node:assert/strict';
873
868
  *
874
869
  * await assert.doesNotReject(
875
870
  * async () => {
876
871
  * throw new TypeError('Wrong value');
877
872
  * },
878
- * SyntaxError
873
+ * SyntaxError,
879
874
  * );
880
875
  * ```
881
876
  *
882
877
  * ```js
883
- * import assert from 'assert/strict';
878
+ * import assert from 'node:assert/strict';
884
879
  *
885
880
  * assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
886
881
  * .then(() => {
@@ -895,7 +890,7 @@ declare module 'assert' {
895
890
  * Expects the `string` input to match the regular expression.
896
891
  *
897
892
  * ```js
898
- * import assert from 'assert/strict';
893
+ * import assert from 'node:assert/strict';
899
894
  *
900
895
  * assert.match('I will fail', /pass/);
901
896
  * // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
@@ -918,7 +913,7 @@ declare module 'assert' {
918
913
  * Expects the `string` input not to match the regular expression.
919
914
  *
920
915
  * ```js
921
- * import assert from 'assert/strict';
916
+ * import assert from 'node:assert/strict';
922
917
  *
923
918
  * assert.doesNotMatch('I will fail', /fail/);
924
919
  * // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...