@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/ts4.8/test.d.ts CHANGED
@@ -10,7 +10,6 @@ declare module 'node:test' {
10
10
  * @returns A {@link TestsStream} that emits events about the test execution.
11
11
  */
12
12
  function run(options?: RunOptions): TestsStream;
13
-
14
13
  /**
15
14
  * The `test()` function is the value imported from the test module. Each invocation of this
16
15
  * function results in reporting the test to the {@link TestsStream}.
@@ -49,7 +48,6 @@ declare module 'node:test' {
49
48
  function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
50
49
  function test(options?: TestOptions, fn?: TestFn): Promise<void>;
51
50
  function test(fn?: TestFn): Promise<void>;
52
-
53
51
  /**
54
52
  * @since v18.6.0
55
53
  * @param name The name of the suite, which is displayed when reporting suite results.
@@ -67,14 +65,12 @@ declare module 'node:test' {
67
65
  function skip(name?: string, fn?: SuiteFn): void;
68
66
  function skip(options?: TestOptions, fn?: SuiteFn): void;
69
67
  function skip(fn?: SuiteFn): void;
70
-
71
68
  // Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`.
72
69
  function todo(name?: string, options?: TestOptions, fn?: SuiteFn): void;
73
70
  function todo(name?: string, fn?: SuiteFn): void;
74
71
  function todo(options?: TestOptions, fn?: SuiteFn): void;
75
72
  function todo(fn?: SuiteFn): void;
76
73
  }
77
-
78
74
  /**
79
75
  * @since v18.6.0
80
76
  * @param name The name of the test, which is displayed when reporting test results.
@@ -93,33 +89,28 @@ declare module 'node:test' {
93
89
  function skip(name?: string, fn?: ItFn): void;
94
90
  function skip(options?: TestOptions, fn?: ItFn): void;
95
91
  function skip(fn?: ItFn): void;
96
-
97
92
  // Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`.
98
93
  function todo(name?: string, options?: TestOptions, fn?: ItFn): void;
99
94
  function todo(name?: string, fn?: ItFn): void;
100
95
  function todo(options?: TestOptions, fn?: ItFn): void;
101
96
  function todo(fn?: ItFn): void;
102
97
  }
103
-
104
98
  /**
105
99
  * The type of a function under test. The first argument to this function is a
106
100
  * {@link TestContext} object. If the test uses callbacks, the callback function is passed as
107
101
  * the second argument.
108
102
  */
109
103
  type TestFn = (t: TestContext, done: (result?: any) => void) => any;
110
-
111
104
  /**
112
105
  * The type of a function under Suite.
113
106
  * If the test uses callbacks, the callback function is passed as an argument
114
107
  */
115
108
  type SuiteFn = (done: (result?: any) => void) => void;
116
-
117
109
  /**
118
110
  * The type of a function under test.
119
111
  * If the test uses callbacks, the callback function is passed as an argument
120
112
  */
121
113
  type ItFn = (done: (result?: any) => void) => any;
122
-
123
114
  interface RunOptions {
124
115
  /**
125
116
  * If a number is provided, then that many files would run in parallel.
@@ -129,26 +120,22 @@ declare module 'node:test' {
129
120
  * @default true
130
121
  */
131
122
  concurrency?: number | boolean | undefined;
132
-
133
123
  /**
134
124
  * An array containing the list of files to run.
135
125
  * If unspecified, the test runner execution model will be used.
136
126
  */
137
127
  files?: readonly string[] | undefined;
138
-
139
128
  /**
140
129
  * Allows aborting an in-progress test execution.
141
130
  * @default undefined
142
131
  */
143
132
  signal?: AbortSignal | undefined;
144
-
145
133
  /**
146
134
  * A number of milliseconds the test will fail after.
147
135
  * If unspecified, subtests inherit this value from their parent.
148
136
  * @default Infinity
149
137
  */
150
138
  timeout?: number | undefined;
151
-
152
139
  /**
153
140
  * Sets inspector port of test child process.
154
141
  * If a nullish value is provided, each process gets its own port,
@@ -156,7 +143,6 @@ declare module 'node:test' {
156
143
  */
157
144
  inspectPort?: number | (() => number) | undefined;
158
145
  }
159
-
160
146
  /**
161
147
  * A successful call of the `run()` method will return a new `TestsStream` object,
162
148
  * streaming a series of events representing the execution of the tests.
@@ -201,19 +187,16 @@ declare module 'node:test' {
201
187
  prependOnceListener(event: 'test:start', listener: (data: TestStart) => void): this;
202
188
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
203
189
  }
204
-
205
190
  interface DiagnosticData {
206
191
  /**
207
192
  * The diagnostic message.
208
193
  */
209
194
  message: string;
210
-
211
195
  /**
212
196
  * The nesting level of the test.
213
197
  */
214
198
  nesting: number;
215
199
  }
216
-
217
200
  interface TestFail {
218
201
  /**
219
202
  * Additional execution metadata.
@@ -223,39 +206,32 @@ declare module 'node:test' {
223
206
  * The duration of the test in milliseconds.
224
207
  */
225
208
  duration: number;
226
-
227
209
  /**
228
210
  * The error thrown by the test.
229
211
  */
230
212
  error: Error;
231
213
  };
232
-
233
214
  /**
234
215
  * The test name.
235
216
  */
236
217
  name: string;
237
-
238
218
  /**
239
219
  * The nesting level of the test.
240
220
  */
241
221
  nesting: number;
242
-
243
222
  /**
244
223
  * The ordinal number of the test.
245
224
  */
246
225
  testNumber: number;
247
-
248
226
  /**
249
227
  * Present if `context.todo` is called.
250
228
  */
251
229
  todo?: string | boolean;
252
-
253
230
  /**
254
231
  * Present if `context.skip` is called.
255
232
  */
256
233
  skip?: string | boolean;
257
234
  }
258
-
259
235
  interface TestPass {
260
236
  /**
261
237
  * Additional execution metadata.
@@ -266,57 +242,47 @@ declare module 'node:test' {
266
242
  */
267
243
  duration: number;
268
244
  };
269
-
270
245
  /**
271
246
  * The test name.
272
247
  */
273
248
  name: string;
274
-
275
249
  /**
276
250
  * The nesting level of the test.
277
251
  */
278
252
  nesting: number;
279
-
280
253
  /**
281
254
  * The ordinal number of the test.
282
255
  */
283
256
  testNumber: number;
284
-
285
257
  /**
286
258
  * Present if `context.todo` is called.
287
259
  */
288
260
  todo?: string | boolean;
289
-
290
261
  /**
291
262
  * Present if `context.skip` is called.
292
263
  */
293
264
  skip?: string | boolean;
294
265
  }
295
-
296
266
  interface TestPlan {
297
267
  /**
298
268
  * The nesting level of the test.
299
269
  */
300
270
  nesting: number;
301
-
302
271
  /**
303
272
  * The number of subtests that have ran.
304
273
  */
305
274
  count: number;
306
275
  }
307
-
308
276
  interface TestStart {
309
277
  /**
310
278
  * The test name.
311
279
  */
312
280
  name: string;
313
-
314
281
  /**
315
282
  * The nesting level of the test.
316
283
  */
317
284
  nesting: number;
318
285
  }
319
-
320
286
  /**
321
287
  * An instance of `TestContext` is passed to each test function in order to interact with the
322
288
  * test runner. However, the `TestContext` constructor is not exposed as part of the API.
@@ -331,7 +297,6 @@ declare module 'node:test' {
331
297
  * @since v18.8.0
332
298
  */
333
299
  beforeEach: typeof beforeEach;
334
-
335
300
  /**
336
301
  * This function is used to create a hook that runs after the current test finishes.
337
302
  * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
@@ -340,7 +305,6 @@ declare module 'node:test' {
340
305
  * @since v18.13.0
341
306
  */
342
307
  after: typeof after;
343
-
344
308
  /**
345
309
  * This function is used to create a hook running after each subtest of the current test.
346
310
  * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
@@ -349,7 +313,6 @@ declare module 'node:test' {
349
313
  * @since v18.8.0
350
314
  */
351
315
  afterEach: typeof afterEach;
352
-
353
316
  /**
354
317
  * This function is used to write diagnostics to the output. Any diagnostic information is
355
318
  * included at the end of the test's results. This function does not return a value.
@@ -357,13 +320,11 @@ declare module 'node:test' {
357
320
  * @since v18.0.0
358
321
  */
359
322
  diagnostic(message: string): void;
360
-
361
323
  /**
362
324
  * The name of the test.
363
325
  * @since v18.8.0
364
326
  */
365
327
  readonly name: string;
366
-
367
328
  /**
368
329
  * If `shouldRunOnlyTests` is truthy, the test context will only run tests that have the `only`
369
330
  * option set. Otherwise, all tests are run. If Node.js was not started with the `--test-only`
@@ -372,13 +333,11 @@ declare module 'node:test' {
372
333
  * @since v18.0.0
373
334
  */
374
335
  runOnly(shouldRunOnlyTests: boolean): void;
375
-
376
336
  /**
377
337
  * Can be used to abort test subtasks when the test has been aborted.
378
338
  * @since v18.7.0
379
339
  */
380
340
  readonly signal: AbortSignal;
381
-
382
341
  /**
383
342
  * This function causes the test's output to indicate the test as skipped. If `message` is
384
343
  * provided, it is included in the output. Calling `skip()` does not terminate execution of
@@ -387,7 +346,6 @@ declare module 'node:test' {
387
346
  * @since v18.0.0
388
347
  */
389
348
  skip(message?: string): void;
390
-
391
349
  /**
392
350
  * This function adds a `TODO` directive to the test's output. If `message` is provided, it is
393
351
  * included in the output. Calling `todo()` does not terminate execution of the test
@@ -396,7 +354,6 @@ declare module 'node:test' {
396
354
  * @since v18.0.0
397
355
  */
398
356
  todo(message?: string): void;
399
-
400
357
  /**
401
358
  * This function is used to create subtests under the current test. This function behaves in
402
359
  * the same fashion as the top level {@link test} function.
@@ -415,7 +372,6 @@ declare module 'node:test' {
415
372
  */
416
373
  readonly mock: MockTracker;
417
374
  }
418
-
419
375
  interface TestOptions {
420
376
  /**
421
377
  * If a number is provided, then that many tests would run in parallel.
@@ -426,27 +382,23 @@ declare module 'node:test' {
426
382
  * @default false
427
383
  */
428
384
  concurrency?: number | boolean | undefined;
429
-
430
385
  /**
431
386
  * If truthy, and the test context is configured to run `only` tests, then this test will be
432
387
  * run. Otherwise, the test is skipped.
433
388
  * @default false
434
389
  */
435
390
  only?: boolean | undefined;
436
-
437
391
  /**
438
392
  * Allows aborting an in-progress test.
439
393
  * @since v18.8.0
440
394
  */
441
395
  signal?: AbortSignal | undefined;
442
-
443
396
  /**
444
397
  * If truthy, the test is skipped. If a string is provided, that string is displayed in the
445
398
  * test results as the reason for skipping the test.
446
399
  * @default false
447
400
  */
448
401
  skip?: boolean | string | undefined;
449
-
450
402
  /**
451
403
  * A number of milliseconds the test will fail after. If unspecified, subtests inherit this
452
404
  * value from their parent.
@@ -454,7 +406,6 @@ declare module 'node:test' {
454
406
  * @since v18.7.0
455
407
  */
456
408
  timeout?: number | undefined;
457
-
458
409
  /**
459
410
  * If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in
460
411
  * the test results as the reason why the test is `TODO`.
@@ -462,7 +413,6 @@ declare module 'node:test' {
462
413
  */
463
414
  todo?: boolean | string | undefined;
464
415
  }
465
-
466
416
  /**
467
417
  * This function is used to create a hook running before running a suite.
468
418
  * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
@@ -471,7 +421,6 @@ declare module 'node:test' {
471
421
  * @since v18.8.0
472
422
  */
473
423
  function before(fn?: HookFn, options?: HookOptions): void;
474
-
475
424
  /**
476
425
  * This function is used to create a hook running after running a suite.
477
426
  * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
@@ -480,7 +429,6 @@ declare module 'node:test' {
480
429
  * @since v18.8.0
481
430
  */
482
431
  function after(fn?: HookFn, options?: HookOptions): void;
483
-
484
432
  /**
485
433
  * This function is used to create a hook running before each subtest of the current suite.
486
434
  * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
@@ -489,7 +437,6 @@ declare module 'node:test' {
489
437
  * @since v18.8.0
490
438
  */
491
439
  function beforeEach(fn?: HookFn, options?: HookOptions): void;
492
-
493
440
  /**
494
441
  * This function is used to create a hook running after each subtest of the current test.
495
442
  * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
@@ -498,13 +445,11 @@ declare module 'node:test' {
498
445
  * @since v18.8.0
499
446
  */
500
447
  function afterEach(fn?: HookFn, options?: HookOptions): void;
501
-
502
448
  /**
503
449
  * The hook function. If the hook uses callbacks, the callback function is passed as the
504
450
  * second argument.
505
451
  */
506
452
  type HookFn = (done: (result?: any) => void) => any;
507
-
508
453
  /**
509
454
  * Configuration options for hooks.
510
455
  * @since v18.8.0
@@ -514,7 +459,6 @@ declare module 'node:test' {
514
459
  * Allows aborting an in-progress hook.
515
460
  */
516
461
  signal?: AbortSignal | undefined;
517
-
518
462
  /**
519
463
  * A number of milliseconds the hook will fail after. If unspecified, subtests inherit this
520
464
  * value from their parent.
@@ -522,7 +466,6 @@ declare module 'node:test' {
522
466
  */
523
467
  timeout?: number | undefined;
524
468
  }
525
-
526
469
  interface MockFunctionOptions {
527
470
  /**
528
471
  * The number of times that the mock will use the behavior of `implementation`.
@@ -533,31 +476,25 @@ declare module 'node:test' {
533
476
  */
534
477
  times?: number | undefined;
535
478
  }
536
-
537
479
  interface MockMethodOptions extends MockFunctionOptions {
538
480
  /**
539
481
  * If `true`, `object[methodName]` is treated as a getter.
540
482
  * This option cannot be used with the `setter` option.
541
483
  */
542
484
  getter?: boolean | undefined;
543
-
544
485
  /**
545
486
  * If `true`, `object[methodName]` is treated as a setter.
546
487
  * This option cannot be used with the `getter` option.
547
488
  */
548
489
  setter?: boolean | undefined;
549
490
  }
550
-
551
491
  type Mock<F extends Function> = F & {
552
492
  mock: MockFunctionContext<F>;
553
493
  };
554
-
555
494
  type NoOpFunction = (...args: any[]) => undefined;
556
-
557
495
  type FunctionPropertyNames<T> = {
558
496
  [K in keyof T]: T[K] extends Function ? K : never;
559
497
  }[keyof T];
560
-
561
498
  interface MockTracker {
562
499
  /**
563
500
  * This function is used to create a mock function.
@@ -568,7 +505,6 @@ declare module 'node:test' {
568
505
  */
569
506
  fn<F extends Function = NoOpFunction>(original?: F, options?: MockFunctionOptions): Mock<F>;
570
507
  fn<F extends Function = NoOpFunction, Implementation extends Function = F>(original?: F, implementation?: Implementation, options?: MockFunctionOptions): Mock<F | Implementation>;
571
-
572
508
  /**
573
509
  * This function is used to create a mock on an existing object method.
574
510
  * @param object The object whose method is being mocked.
@@ -631,7 +567,6 @@ declare module 'node:test' {
631
567
  implementation?: Implementation,
632
568
  options?: MockFunctionOptions,
633
569
  ): Mock<(() => MockedObject[MethodName]) | Implementation>;
634
-
635
570
  /**
636
571
  * This function is syntax sugar for {@link MockTracker.method} with `options.setter` set to `true`.
637
572
  */
@@ -653,7 +588,6 @@ declare module 'node:test' {
653
588
  implementation?: Implementation,
654
589
  options?: MockFunctionOptions,
655
590
  ): Mock<((value: MockedObject[MethodName]) => void) | Implementation>;
656
-
657
591
  /**
658
592
  * This function restores the default behavior of all mocks that were previously created by this `MockTracker`
659
593
  * and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used,
@@ -663,7 +597,6 @@ declare module 'node:test' {
663
597
  * If the global `MockTracker` is used extensively, calling this function manually is recommended.
664
598
  */
665
599
  reset(): void;
666
-
667
600
  /**
668
601
  * This function restores the default behavior of all mocks that were previously created by this `MockTracker`.
669
602
  * Unlike `mock.reset()`, `mock.restoreAll()` does not disassociate the mocks from the `MockTracker` instance.
@@ -672,7 +605,6 @@ declare module 'node:test' {
672
605
  }
673
606
 
674
607
  const mock: MockTracker;
675
-
676
608
  interface MockFunctionCall<
677
609
  F extends Function,
678
610
  ReturnType = F extends (...args: any) => infer T
@@ -714,26 +646,22 @@ declare module 'node:test' {
714
646
  */
715
647
  this: unknown;
716
648
  }
717
-
718
649
  interface MockFunctionContext<F extends Function> {
719
650
  /**
720
651
  * A getter that returns a copy of the internal array used to track calls to the mock.
721
652
  */
722
653
  readonly calls: Array<MockFunctionCall<F>>;
723
-
724
654
  /**
725
655
  * This function returns the number of times that this mock has been invoked.
726
656
  * This function is more efficient than checking `ctx.calls.length`
727
657
  * because `ctx.calls` is a getter that creates a copy of the internal call tracking array.
728
658
  */
729
659
  callCount(): number;
730
-
731
660
  /**
732
661
  * This function is used to change the behavior of an existing mock.
733
662
  * @param implementation The function to be used as the mock's new implementation.
734
663
  */
735
664
  mockImplementation(implementation: Function): void;
736
-
737
665
  /**
738
666
  * This function is used to change the behavior of an existing mock for a single invocation.
739
667
  * Once invocation `onCall` has occurred, the mock will revert to whatever behavior
@@ -743,18 +671,15 @@ declare module 'node:test' {
743
671
  * If the specified invocation has already occurred then an exception is thrown.
744
672
  */
745
673
  mockImplementationOnce(implementation: Function, onCall?: number): void;
746
-
747
674
  /**
748
675
  * Resets the call history of the mock function.
749
676
  */
750
677
  resetCalls(): void;
751
-
752
678
  /**
753
679
  * Resets the implementation of the mock function to its original behavior.
754
680
  * The mock can still be used after calling this function.
755
681
  */
756
682
  restore(): void;
757
683
  }
758
-
759
684
  export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock };
760
685
  }
@@ -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('timers/promises')`.
3
+ * that return `Promise` objects. The API is accessible via`require('node:timers/promises')`.
4
4
  *
5
5
  * ```js
6
6
  * import {
@@ -44,6 +44,8 @@ declare module 'timers/promises' {
44
44
  function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
45
45
  /**
46
46
  * Returns an async iterator that generates values in an interval of `delay` ms.
47
+ * If `ref` is `true`, you need to call `next()` of async iterator explicitly
48
+ * or implicitly to keep the event loop alive.
47
49
  *
48
50
  * ```js
49
51
  * import {
@@ -62,7 +64,6 @@ declare module 'timers/promises' {
62
64
  * @since v15.9.0
63
65
  */
64
66
  function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
65
-
66
67
  interface Scheduler {
67
68
  /**
68
69
  * ```js
@@ -85,7 +86,6 @@ declare module 'timers/promises' {
85
86
  */
86
87
  yield: () => Promise<void>;
87
88
  }
88
-
89
89
  const scheduler: Scheduler;
90
90
  }
91
91
  declare module 'node:timers/promises' {
node/ts4.8/timers.d.ts CHANGED
@@ -1,12 +1,12 @@
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('timers')` to use the API.
4
+ * globals, there is no need to call `require('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
8
8
  * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
9
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/timers.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/timers.js)
10
10
  */
11
11
  declare module 'timers' {
12
12
  import { Abortable } from 'node:events';
node/ts4.8/tls.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  /**
2
- * The `tls` module provides an implementation of the Transport Layer Security
2
+ * The `node:tls` module provides an implementation of the Transport Layer Security
3
3
  * (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL.
4
4
  * The module can be accessed using:
5
5
  *
6
6
  * ```js
7
- * const tls = require('tls');
7
+ * const tls = require('node:tls');
8
8
  * ```
9
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/tls.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/tls.js)
10
10
  */
11
11
  declare module 'tls' {
12
12
  import { X509Certificate } from 'node:crypto';
@@ -212,7 +212,7 @@ declare module 'tls' {
212
212
  *
213
213
  * Instances of `tls.TLSSocket` implement the duplex `Stream` interface.
214
214
  *
215
- * Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate} will only return data while the
215
+ * Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate}) will only return data while the
216
216
  * connection is open.
217
217
  * @since v0.11.4
218
218
  */
@@ -259,13 +259,13 @@ declare module 'tls' {
259
259
  /**
260
260
  * Returns an object containing information on the negotiated cipher suite.
261
261
  *
262
- * For example:
262
+ * For example, a TLSv1.2 protocol with AES256-SHA cipher:
263
263
  *
264
264
  * ```json
265
265
  * {
266
- * "name": "AES128-SHA256",
267
- * "standardName": "TLS_RSA_WITH_AES_128_CBC_SHA256",
268
- * "version": "TLSv1.2"
266
+ * "name": "AES256-SHA",
267
+ * "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA",
268
+ * "version": "SSLv3"
269
269
  * }
270
270
  * ```
271
271
  *
@@ -912,14 +912,14 @@ declare module 'tls' {
912
912
  * Creates a new {@link Server}. The `secureConnectionListener`, if provided, is
913
913
  * automatically set as a listener for the `'secureConnection'` event.
914
914
  *
915
- * The `ticketKeys` options is automatically shared between `cluster` module
915
+ * The `ticketKeys` options is automatically shared between `node:cluster` module
916
916
  * workers.
917
917
  *
918
918
  * The following illustrates a simple echo server:
919
919
  *
920
920
  * ```js
921
- * const tls = require('tls');
922
- * const fs = require('fs');
921
+ * const tls = require('node:tls');
922
+ * const fs = require('node:fs');
923
923
  *
924
924
  * const options = {
925
925
  * key: fs.readFileSync('server-key.pem'),
@@ -929,7 +929,7 @@ declare module 'tls' {
929
929
  * requestCert: true,
930
930
  *
931
931
  * // This is necessary only if the client uses a self-signed certificate.
932
- * ca: [ fs.readFileSync('client-cert.pem') ]
932
+ * ca: [ fs.readFileSync('client-cert.pem') ],
933
933
  * };
934
934
  *
935
935
  * const server = tls.createServer(options, (socket) => {
@@ -964,8 +964,8 @@ declare module 'tls' {
964
964
  *
965
965
  * ```js
966
966
  * // Assumes an echo server that is listening on port 8000.
967
- * const tls = require('tls');
968
- * const fs = require('fs');
967
+ * const tls = require('node:tls');
968
+ * const fs = require('node:fs');
969
969
  *
970
970
  * const options = {
971
971
  * // Necessary only if the server requires client certificate authentication.
@@ -1041,12 +1041,19 @@ declare module 'tls' {
1041
1041
  * APIs that create secure contexts have no default value.
1042
1042
  *
1043
1043
  * The `tls.createSecureContext()` method creates a `SecureContext` object. It is
1044
- * usable as an argument to several `tls` APIs, such as {@link createServer} and `server.addContext()`, but has no public methods.
1044
+ * usable as an argument to several `tls` APIs, such as `server.addContext()`,
1045
+ * but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option.
1045
1046
  *
1046
1047
  * A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it.
1047
1048
  *
1048
1049
  * If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of
1049
1050
  * CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt).
1051
+ *
1052
+ * Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto'`option. When set to `'auto'`, well-known DHE parameters of sufficient strength
1053
+ * will be selected automatically. Otherwise, if necessary, `openssl dhparam` can
1054
+ * be used to create custom parameters. The key length must be greater than or
1055
+ * equal to 1024 bits or else an error will be thrown. Although 1024 bits is
1056
+ * permissible, use 2048 bits or larger for stronger security.
1050
1057
  * @since v0.11.13
1051
1058
  */
1052
1059
  function createSecureContext(options?: SecureContextOptions): SecureContext;
@@ -1092,6 +1099,13 @@ declare module 'tls' {
1092
1099
  * are provided, the lowest minimum is used.
1093
1100
  */
1094
1101
  let DEFAULT_MIN_VERSION: SecureVersion;
1102
+ /**
1103
+ * The default value of the ciphers option of tls.createSecureContext().
1104
+ * It can be assigned any of the supported OpenSSL ciphers.
1105
+ * Defaults to the content of crypto.constants.defaultCoreCipherList, unless
1106
+ * changed using CLI options using --tls-default-ciphers.
1107
+ */
1108
+ let DEFAULT_CIPHERS: string;
1095
1109
  /**
1096
1110
  * An immutable array of strings representing the root certificates (in PEM
1097
1111
  * format) used for verifying peer certificates. This is the default value