@types/node 18.11.5 → 20.2.5

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 (97) hide show
  1. node/README.md +2 -2
  2. node/assert.d.ts +86 -75
  3. node/async_hooks.d.ts +66 -37
  4. node/buffer.d.ts +193 -100
  5. node/child_process.d.ts +82 -56
  6. node/cluster.d.ts +12 -12
  7. node/console.d.ts +5 -5
  8. node/crypto.d.ts +233 -235
  9. node/dgram.d.ts +15 -15
  10. node/diagnostics_channel.d.ts +59 -21
  11. node/dns/promises.d.ts +50 -6
  12. node/dns.d.ts +26 -17
  13. node/domain.d.ts +4 -4
  14. node/events.d.ts +111 -65
  15. node/fs/promises.d.ts +99 -47
  16. node/fs.d.ts +244 -73
  17. node/globals.d.ts +6 -3
  18. node/http.d.ts +265 -148
  19. node/http2.d.ts +42 -47
  20. node/https.d.ts +53 -153
  21. node/index.d.ts +2 -1
  22. node/inspector.d.ts +10 -3
  23. node/module.d.ts +6 -4
  24. node/net.d.ts +32 -15
  25. node/os.d.ts +27 -16
  26. node/package.json +9 -4
  27. node/path.d.ts +4 -4
  28. node/perf_hooks.d.ts +28 -15
  29. node/process.d.ts +49 -46
  30. node/punycode.d.ts +1 -1
  31. node/querystring.d.ts +5 -5
  32. node/readline/promises.d.ts +65 -63
  33. node/readline.d.ts +32 -159
  34. node/repl.d.ts +20 -20
  35. node/stream/consumers.d.ts +1 -1
  36. node/stream.d.ts +950 -869
  37. node/string_decoder.d.ts +6 -6
  38. node/test.d.ts +877 -139
  39. node/timers/promises.d.ts +26 -1
  40. node/timers.d.ts +125 -4
  41. node/tls.d.ts +120 -29
  42. node/trace_events.d.ts +20 -9
  43. node/ts4.8/assert.d.ts +86 -75
  44. node/ts4.8/async_hooks.d.ts +66 -37
  45. node/ts4.8/buffer.d.ts +193 -101
  46. node/ts4.8/child_process.d.ts +82 -56
  47. node/ts4.8/cluster.d.ts +12 -12
  48. node/ts4.8/console.d.ts +5 -5
  49. node/ts4.8/crypto.d.ts +230 -233
  50. node/ts4.8/dgram.d.ts +15 -15
  51. node/ts4.8/diagnostics_channel.d.ts +59 -21
  52. node/ts4.8/dns/promises.d.ts +50 -6
  53. node/ts4.8/dns.d.ts +26 -17
  54. node/ts4.8/domain.d.ts +4 -4
  55. node/ts4.8/events.d.ts +111 -65
  56. node/ts4.8/fs/promises.d.ts +97 -46
  57. node/ts4.8/fs.d.ts +244 -73
  58. node/ts4.8/globals.d.ts +21 -12
  59. node/ts4.8/http.d.ts +265 -148
  60. node/ts4.8/http2.d.ts +42 -47
  61. node/ts4.8/https.d.ts +53 -153
  62. node/ts4.8/inspector.d.ts +10 -3
  63. node/ts4.8/module.d.ts +6 -4
  64. node/ts4.8/net.d.ts +33 -16
  65. node/ts4.8/os.d.ts +27 -16
  66. node/ts4.8/path.d.ts +4 -4
  67. node/ts4.8/perf_hooks.d.ts +28 -15
  68. node/ts4.8/process.d.ts +49 -46
  69. node/ts4.8/punycode.d.ts +1 -1
  70. node/ts4.8/querystring.d.ts +5 -5
  71. node/ts4.8/readline/promises.d.ts +65 -63
  72. node/ts4.8/readline.d.ts +32 -159
  73. node/ts4.8/repl.d.ts +20 -20
  74. node/ts4.8/stream/consumers.d.ts +1 -1
  75. node/ts4.8/stream.d.ts +192 -140
  76. node/ts4.8/string_decoder.d.ts +6 -6
  77. node/ts4.8/test.d.ts +877 -139
  78. node/ts4.8/timers/promises.d.ts +26 -1
  79. node/ts4.8/timers.d.ts +125 -4
  80. node/ts4.8/tls.d.ts +120 -29
  81. node/ts4.8/trace_events.d.ts +20 -9
  82. node/ts4.8/tty.d.ts +4 -5
  83. node/ts4.8/url.d.ts +46 -42
  84. node/ts4.8/util.d.ts +325 -123
  85. node/ts4.8/v8.d.ts +253 -14
  86. node/ts4.8/vm.d.ts +417 -32
  87. node/ts4.8/wasi.d.ts +13 -19
  88. node/ts4.8/worker_threads.d.ts +38 -34
  89. node/ts4.8/zlib.d.ts +11 -11
  90. node/tty.d.ts +4 -5
  91. node/url.d.ts +46 -42
  92. node/util.d.ts +325 -123
  93. node/v8.d.ts +253 -14
  94. node/vm.d.ts +417 -32
  95. node/wasi.d.ts +13 -19
  96. node/worker_threads.d.ts +38 -34
  97. node/zlib.d.ts +11 -11
node/https.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
3
3
  * separate module.
4
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/https.js)
4
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/https.js)
5
5
  */
6
6
  declare module 'https' {
7
7
  import { Duplex } from 'node:stream';
@@ -14,6 +14,7 @@ declare module 'https' {
14
14
  > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>;
15
15
  type RequestOptions = http.RequestOptions &
16
16
  tls.SecureContextOptions & {
17
+ checkServerIdentity?: typeof tls.checkServerIdentity | undefined;
17
18
  rejectUnauthorized?: boolean | undefined; // Defaults to true
18
19
  servername?: string | undefined; // SNI TLS Extension
19
20
  };
@@ -58,22 +59,9 @@ declare module 'https' {
58
59
  closeIdleConnections(): void;
59
60
  addListener(event: string, listener: (...args: any[]) => void): this;
60
61
  addListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
61
- addListener(
62
- event: 'newSession',
63
- listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
64
- ): this;
65
- addListener(
66
- event: 'OCSPRequest',
67
- listener: (
68
- certificate: Buffer,
69
- issuer: Buffer,
70
- callback: (err: Error | null, resp: Buffer) => void,
71
- ) => void,
72
- ): this;
73
- addListener(
74
- event: 'resumeSession',
75
- listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
76
- ): this;
62
+ addListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
63
+ addListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
64
+ addListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
77
65
  addListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
78
66
  addListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
79
67
  addListener(event: 'close', listener: () => void): this;
@@ -83,29 +71,13 @@ declare module 'https' {
83
71
  addListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
84
72
  addListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
85
73
  addListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
86
- addListener(
87
- event: 'connect',
88
- listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
89
- ): this;
74
+ addListener(event: 'connect', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
90
75
  addListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
91
- addListener(
92
- event: 'upgrade',
93
- listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
94
- ): this;
76
+ addListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
95
77
  emit(event: string, ...args: any[]): boolean;
96
78
  emit(event: 'keylog', line: Buffer, tlsSocket: tls.TLSSocket): boolean;
97
- emit(
98
- event: 'newSession',
99
- sessionId: Buffer,
100
- sessionData: Buffer,
101
- callback: (err: Error, resp: Buffer) => void,
102
- ): boolean;
103
- emit(
104
- event: 'OCSPRequest',
105
- certificate: Buffer,
106
- issuer: Buffer,
107
- callback: (err: Error | null, resp: Buffer) => void,
108
- ): boolean;
79
+ emit(event: 'newSession', sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void): boolean;
80
+ emit(event: 'OCSPRequest', certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean;
109
81
  emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean;
110
82
  emit(event: 'secureConnection', tlsSocket: tls.TLSSocket): boolean;
111
83
  emit(event: 'tlsClientError', err: Error, tlsSocket: tls.TLSSocket): boolean;
@@ -116,39 +88,32 @@ declare module 'https' {
116
88
  emit(
117
89
  event: 'checkContinue',
118
90
  req: InstanceType<Request>,
119
- res: InstanceType<Response> & { req: InstanceType<Request> },
91
+ res: InstanceType<Response> & {
92
+ req: InstanceType<Request>;
93
+ }
120
94
  ): boolean;
121
95
  emit(
122
96
  event: 'checkExpectation',
123
97
  req: InstanceType<Request>,
124
- res: InstanceType<Response> & { req: InstanceType<Request> },
98
+ res: InstanceType<Response> & {
99
+ req: InstanceType<Request>;
100
+ }
125
101
  ): boolean;
126
102
  emit(event: 'clientError', err: Error, socket: Duplex): boolean;
127
103
  emit(event: 'connect', req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
128
104
  emit(
129
105
  event: 'request',
130
106
  req: InstanceType<Request>,
131
- res: InstanceType<Response> & { req: InstanceType<Request> },
107
+ res: InstanceType<Response> & {
108
+ req: InstanceType<Request>;
109
+ }
132
110
  ): boolean;
133
111
  emit(event: 'upgrade', req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
134
112
  on(event: string, listener: (...args: any[]) => void): this;
135
113
  on(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
136
- on(
137
- event: 'newSession',
138
- listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
139
- ): this;
140
- on(
141
- event: 'OCSPRequest',
142
- listener: (
143
- certificate: Buffer,
144
- issuer: Buffer,
145
- callback: (err: Error | null, resp: Buffer) => void,
146
- ) => void,
147
- ): this;
148
- on(
149
- event: 'resumeSession',
150
- listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
151
- ): this;
114
+ on(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
115
+ on(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
116
+ on(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
152
117
  on(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
153
118
  on(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
154
119
  on(event: 'close', listener: () => void): this;
@@ -163,22 +128,9 @@ declare module 'https' {
163
128
  on(event: 'upgrade', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
164
129
  once(event: string, listener: (...args: any[]) => void): this;
165
130
  once(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
166
- once(
167
- event: 'newSession',
168
- listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
169
- ): this;
170
- once(
171
- event: 'OCSPRequest',
172
- listener: (
173
- certificate: Buffer,
174
- issuer: Buffer,
175
- callback: (err: Error | null, resp: Buffer) => void,
176
- ) => void,
177
- ): this;
178
- once(
179
- event: 'resumeSession',
180
- listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
181
- ): this;
131
+ once(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
132
+ once(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
133
+ once(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
182
134
  once(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
183
135
  once(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
184
136
  once(event: 'close', listener: () => void): this;
@@ -193,22 +145,9 @@ declare module 'https' {
193
145
  once(event: 'upgrade', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
194
146
  prependListener(event: string, listener: (...args: any[]) => void): this;
195
147
  prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
196
- prependListener(
197
- event: 'newSession',
198
- listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
199
- ): this;
200
- prependListener(
201
- event: 'OCSPRequest',
202
- listener: (
203
- certificate: Buffer,
204
- issuer: Buffer,
205
- callback: (err: Error | null, resp: Buffer) => void,
206
- ) => void,
207
- ): this;
208
- prependListener(
209
- event: 'resumeSession',
210
- listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
211
- ): this;
148
+ prependListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
149
+ prependListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
150
+ prependListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
212
151
  prependListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
213
152
  prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
214
153
  prependListener(event: 'close', listener: () => void): this;
@@ -218,33 +157,14 @@ declare module 'https' {
218
157
  prependListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
219
158
  prependListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
220
159
  prependListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
221
- prependListener(
222
- event: 'connect',
223
- listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
224
- ): this;
160
+ prependListener(event: 'connect', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
225
161
  prependListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
226
- prependListener(
227
- event: 'upgrade',
228
- listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
229
- ): this;
162
+ prependListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
230
163
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
231
164
  prependOnceListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
232
- prependOnceListener(
233
- event: 'newSession',
234
- listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
235
- ): this;
236
- prependOnceListener(
237
- event: 'OCSPRequest',
238
- listener: (
239
- certificate: Buffer,
240
- issuer: Buffer,
241
- callback: (err: Error | null, resp: Buffer) => void,
242
- ) => void,
243
- ): this;
244
- prependOnceListener(
245
- event: 'resumeSession',
246
- listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
247
- ): this;
165
+ prependOnceListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
166
+ prependOnceListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
167
+ prependOnceListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
248
168
  prependOnceListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
249
169
  prependOnceListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
250
170
  prependOnceListener(event: 'close', listener: () => void): this;
@@ -254,25 +174,19 @@ declare module 'https' {
254
174
  prependOnceListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
255
175
  prependOnceListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
256
176
  prependOnceListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
257
- prependOnceListener(
258
- event: 'connect',
259
- listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
260
- ): this;
177
+ prependOnceListener(event: 'connect', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
261
178
  prependOnceListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
262
- prependOnceListener(
263
- event: 'upgrade',
264
- listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
265
- ): this;
179
+ prependOnceListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
266
180
  }
267
181
  /**
268
182
  * ```js
269
183
  * // curl -k https://localhost:8000/
270
- * const https = require('https');
271
- * const fs = require('fs');
184
+ * const https = require('node:https');
185
+ * const fs = require('node:fs');
272
186
  *
273
187
  * const options = {
274
188
  * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
275
- * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
189
+ * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
276
190
  * };
277
191
  *
278
192
  * https.createServer(options, (req, res) => {
@@ -284,12 +198,12 @@ declare module 'https' {
284
198
  * Or
285
199
  *
286
200
  * ```js
287
- * const https = require('https');
288
- * const fs = require('fs');
201
+ * const https = require('node:https');
202
+ * const fs = require('node:fs');
289
203
  *
290
204
  * const options = {
291
205
  * pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
292
- * passphrase: 'sample'
206
+ * passphrase: 'sample',
293
207
  * };
294
208
  *
295
209
  * https.createServer(options, (req, res) => {
@@ -325,13 +239,13 @@ declare module 'https' {
325
239
  * upload a file with a POST request, then write to the `ClientRequest` object.
326
240
  *
327
241
  * ```js
328
- * const https = require('https');
242
+ * const https = require('node:https');
329
243
  *
330
244
  * const options = {
331
245
  * hostname: 'encrypted.google.com',
332
246
  * port: 443,
333
247
  * path: '/',
334
- * method: 'GET'
248
+ * method: 'GET',
335
249
  * };
336
250
  *
337
251
  * const req = https.request(options, (res) => {
@@ -358,7 +272,7 @@ declare module 'https' {
358
272
  * path: '/',
359
273
  * method: 'GET',
360
274
  * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
361
- * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
275
+ * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
362
276
  * };
363
277
  * options.agent = new https.Agent(options);
364
278
  *
@@ -377,7 +291,7 @@ declare module 'https' {
377
291
  * method: 'GET',
378
292
  * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
379
293
  * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
380
- * agent: false
294
+ * agent: false,
381
295
  * };
382
296
  *
383
297
  * const req = https.request(options, (res) => {
@@ -398,9 +312,9 @@ declare module 'https' {
398
312
  * Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`):
399
313
  *
400
314
  * ```js
401
- * const tls = require('tls');
402
- * const https = require('https');
403
- * const crypto = require('crypto');
315
+ * const tls = require('node:tls');
316
+ * const https = require('node:https');
317
+ * const crypto = require('node:crypto');
404
318
  *
405
319
  * function sha256(s) {
406
320
  * return crypto.createHash('sha256').update(s).digest('base64');
@@ -417,7 +331,7 @@ declare module 'https' {
417
331
  * return err;
418
332
  * }
419
333
  *
420
- * // Pin the public key, similar to HPKP pin-sha25 pinning
334
+ * // Pin the public key, similar to HPKP pin-sha256 pinning
421
335
  * const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=';
422
336
  * if (sha256(cert.pubkey) !== pubkey256) {
423
337
  * const msg = 'Certificate verification error: ' +
@@ -492,15 +406,8 @@ declare module 'https' {
492
406
  * @since v0.3.6
493
407
  * @param options Accepts all `options` from `request`, with some differences in default values:
494
408
  */
495
- function request(
496
- options: RequestOptions | string | URL,
497
- callback?: (res: http.IncomingMessage) => void,
498
- ): http.ClientRequest;
499
- function request(
500
- url: string | URL,
501
- options: RequestOptions,
502
- callback?: (res: http.IncomingMessage) => void,
503
- ): http.ClientRequest;
409
+ function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
410
+ function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
504
411
  /**
505
412
  * Like `http.get()` but for HTTPS.
506
413
  *
@@ -508,7 +415,7 @@ declare module 'https' {
508
415
  * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
509
416
  *
510
417
  * ```js
511
- * const https = require('https');
418
+ * const https = require('node:https');
512
419
  *
513
420
  * https.get('https://encrypted.google.com/', (res) => {
514
421
  * console.log('statusCode:', res.statusCode);
@@ -525,15 +432,8 @@ declare module 'https' {
525
432
  * @since v0.3.6
526
433
  * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`.
527
434
  */
528
- function get(
529
- options: RequestOptions | string | URL,
530
- callback?: (res: http.IncomingMessage) => void,
531
- ): http.ClientRequest;
532
- function get(
533
- url: string | URL,
534
- options: RequestOptions,
535
- callback?: (res: http.IncomingMessage) => void,
536
- ): http.ClientRequest;
435
+ function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
436
+ function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
537
437
  let globalAgent: Agent;
538
438
  }
539
439
  declare module 'node:https' {
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 18.11
1
+ // Type definitions for non-npm package Node.js 20.2
2
2
  // Project: https://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
@@ -41,6 +41,7 @@
41
41
  // Linus Unnebäck <https://github.com/LinusU>
42
42
  // wafuwafu13 <https://github.com/wafuwafu13>
43
43
  // Matteo Collina <https://github.com/mcollina>
44
+ // Dmitry Semigradsky <https://github.com/Semigradsky>
44
45
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
45
46
 
46
47
  /**
node/inspector.d.ts CHANGED
@@ -8,14 +8,21 @@
8
8
  // tslint:disable:max-line-length
9
9
 
10
10
  /**
11
- * The `inspector` module provides an API for interacting with the V8 inspector.
11
+ * The `node:inspector` module provides an API for interacting with the V8
12
+ * inspector.
12
13
  *
13
14
  * It can be accessed using:
14
15
  *
15
16
  * ```js
16
- * const inspector = require('inspector');
17
+ * import * as inspector from 'node:inspector/promises';
17
18
  * ```
18
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/inspector.js)
19
+ *
20
+ * or
21
+ *
22
+ * ```js
23
+ * import * as inspector from 'node:inspector';
24
+ * ```
25
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/inspector.js)
19
26
  */
20
27
  declare module 'inspector' {
21
28
  import EventEmitter = require('node:events');
node/module.d.ts CHANGED
@@ -10,9 +10,9 @@ declare module 'module' {
10
10
  * does not add or remove exported names from the `ES Modules`.
11
11
  *
12
12
  * ```js
13
- * const fs = require('fs');
14
- * const assert = require('assert');
15
- * const { syncBuiltinESMExports } = require('module');
13
+ * const fs = require('node:fs');
14
+ * const assert = require('node:assert');
15
+ * const { syncBuiltinESMExports } = require('node:module');
16
16
  *
17
17
  * fs.readFile = newAPI;
18
18
  *
@@ -26,7 +26,7 @@ declare module 'module' {
26
26
  *
27
27
  * syncBuiltinESMExports();
28
28
  *
29
- * import('fs').then((esmFS) => {
29
+ * import('node:fs').then((esmFS) => {
30
30
  * // It syncs the existing readFile property with the new value
31
31
  * assert.strictEqual(esmFS.readFile, newAPI);
32
32
  * // readFileSync has been deleted from the required fs
@@ -44,6 +44,7 @@ declare module 'module' {
44
44
  * `path` is the resolved path for the file for which a corresponding source map
45
45
  * should be fetched.
46
46
  * @since v13.7.0, v12.17.0
47
+ * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
47
48
  */
48
49
  function findSourceMap(path: string, error?: Error): SourceMap;
49
50
  interface SourceMapPayload {
@@ -85,6 +86,7 @@ declare module 'module' {
85
86
  static wrap(code: string): string;
86
87
  static createRequire(path: string | URL): NodeRequire;
87
88
  static builtinModules: string[];
89
+ static isBuiltin(moduleName: string): boolean;
88
90
  static Module: typeof Module;
89
91
  constructor(id: string, parent?: Module);
90
92
  }
node/net.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * > Stability: 2 - Stable
3
3
  *
4
- * The `net` module provides an asynchronous network API for creating stream-based
4
+ * The `node:net` module provides an asynchronous network API for creating stream-based
5
5
  * TCP or `IPC` servers ({@link createServer}) and clients
6
6
  * ({@link createConnection}).
7
7
  *
8
8
  * It can be accessed using:
9
9
  *
10
10
  * ```js
11
- * const net = require('net');
11
+ * const net = require('node:net');
12
12
  * ```
13
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/net.js)
13
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/net.js)
14
14
  */
15
15
  declare module 'net' {
16
16
  import * as stream from 'node:stream';
@@ -57,6 +57,14 @@ declare module 'net' {
57
57
  noDelay?: boolean | undefined;
58
58
  keepAlive?: boolean | undefined;
59
59
  keepAliveInitialDelay?: number | undefined;
60
+ /**
61
+ * @since v18.13.0
62
+ */
63
+ autoSelectFamily?: boolean | undefined;
64
+ /**
65
+ * @since v18.13.0
66
+ */
67
+ autoSelectFamilyAttemptTimeout?: number | undefined;
60
68
  }
61
69
  interface IpcSocketConnectOpts extends ConnectOpts {
62
70
  path: string;
@@ -133,13 +141,10 @@ declare module 'net' {
133
141
  pause(): this;
134
142
  /**
135
143
  * Close the TCP connection by sending an RST packet and destroy the stream.
136
- * If this TCP socket is in connecting status, it will send an RST packet
137
- * and destroy this TCP socket once it is connected. Otherwise, it will call
138
- * `socket.destroy` with an `ERR_SOCKET_CLOSED` Error. If this is not a TCP socket
139
- * (for example, a pipe), calling this method will immediately throw
140
- * an `ERR_INVALID_HANDLE_TYPE` Error.
141
- * @since v18.3.0
142
- * @return The socket itself.
144
+ * If this TCP socket is in connecting status, it will send an RST packet and destroy this TCP socket once it is connected.
145
+ * Otherwise, it will call `socket.destroy` with an `ERR_SOCKET_CLOSED` Error.
146
+ * If this is not a TCP socket (for example, a pipe), calling this method will immediately throw an `ERR_INVALID_HANDLE_TYPE` Error.
147
+ * @since v18.3.0, v16.17.0
143
148
  */
144
149
  resetAndDestroy(): this;
145
150
  /**
@@ -261,6 +266,12 @@ declare module 'net' {
261
266
  * @since v6.1.0
262
267
  */
263
268
  readonly connecting: boolean;
269
+ /**
270
+ * This is `true` if the socket is not connected yet, either because `.connect()`has not yet been called or because it is still in the process of connecting
271
+ * (see `socket.connecting`).
272
+ * @since v11.2.0, v10.16.0
273
+ */
274
+ readonly pending: boolean;
264
275
  /**
265
276
  * See `writable.destroyed` for further details.
266
277
  */
@@ -279,12 +290,16 @@ declare module 'net' {
279
290
  readonly localPort?: number;
280
291
  /**
281
292
  * The string representation of the local IP family. `'IPv4'` or `'IPv6'`.
282
- * @since v18.8.0
293
+ * @since v18.8.0, v16.18.0
283
294
  */
284
295
  readonly localFamily?: string;
285
296
  /**
286
297
  * This property represents the state of the connection as a string.
287
- * @see {https://nodejs.org/api/net.html#socketreadystate}
298
+ *
299
+ * * If the stream is connecting `socket.readyState` is `opening`.
300
+ * * If the stream is readable and writable, it is `open`.
301
+ * * If the stream is readable and not writable, it is `readOnly`.
302
+ * * If the stream is not readable and writable, it is `writeOnly`.
288
303
  * @since v0.5.0
289
304
  */
290
305
  readonly readyState: SocketReadyState;
@@ -305,7 +320,8 @@ declare module 'net' {
305
320
  */
306
321
  readonly remotePort?: number | undefined;
307
322
  /**
308
- * The socket timeout in milliseconds as set by socket.setTimeout(). It is undefined if a timeout has not been set.
323
+ * The socket timeout in milliseconds as set by `socket.setTimeout()`.
324
+ * It is `undefined` if a timeout has not been set.
309
325
  * @since v10.7.0
310
326
  */
311
327
  readonly timeout?: number | undefined;
@@ -486,7 +502,7 @@ declare module 'net' {
486
502
  * ```js
487
503
  * server.on('error', (e) => {
488
504
  * if (e.code === 'EADDRINUSE') {
489
- * console.log('Address in use, retrying...');
505
+ * console.error('Address in use, retrying...');
490
506
  * setTimeout(() => {
491
507
  * server.close();
492
508
  * server.listen(PORT, HOST);
@@ -708,7 +724,7 @@ declare module 'net' {
708
724
  * on port 8124:
709
725
  *
710
726
  * ```js
711
- * const net = require('net');
727
+ * const net = require('node:net');
712
728
  * const server = net.createServer((c) => {
713
729
  * // 'connection' listener.
714
730
  * console.log('client connected');
@@ -846,6 +862,7 @@ declare module 'net' {
846
862
  class SocketAddress {
847
863
  constructor(options: SocketAddressInitOptions);
848
864
  /**
865
+ * Either \`'ipv4'\` or \`'ipv6'\`.
849
866
  * @since v15.14.0, v14.18.0
850
867
  */
851
868
  readonly address: string;
node/os.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * The `os` module provides operating system-related utility methods and
2
+ * The `node:os` module provides operating system-related utility methods and
3
3
  * properties. It can be accessed using:
4
4
  *
5
5
  * ```js
6
- * const os = require('os');
6
+ * const os = require('node:os');
7
7
  * ```
8
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/os.js)
8
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/os.js)
9
9
  */
10
10
  declare module 'os' {
11
11
  interface CpuInfo {
@@ -75,6 +75,7 @@ declare module 'os' {
75
75
  function totalmem(): number;
76
76
  /**
77
77
  * Returns an array of objects containing information about each logical CPU core.
78
+ * The array will be empty if no CPU information is available, such as if the`/proc` file system is unavailable.
78
79
  *
79
80
  * The properties included on each object include:
80
81
  *
@@ -88,8 +89,8 @@ declare module 'os' {
88
89
  * nice: 0,
89
90
  * sys: 30340,
90
91
  * idle: 1070356870,
91
- * irq: 0
92
- * }
92
+ * irq: 0,
93
+ * },
93
94
  * },
94
95
  * {
95
96
  * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@@ -99,8 +100,8 @@ declare module 'os' {
99
100
  * nice: 0,
100
101
  * sys: 26980,
101
102
  * idle: 1071569080,
102
- * irq: 0
103
- * }
103
+ * irq: 0,
104
+ * },
104
105
  * },
105
106
  * {
106
107
  * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@@ -110,8 +111,8 @@ declare module 'os' {
110
111
  * nice: 0,
111
112
  * sys: 21750,
112
113
  * idle: 1070919370,
113
- * irq: 0
114
- * }
114
+ * irq: 0,
115
+ * },
115
116
  * },
116
117
  * {
117
118
  * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@@ -121,17 +122,28 @@ declare module 'os' {
121
122
  * nice: 0,
122
123
  * sys: 19430,
123
124
  * idle: 1070905480,
124
- * irq: 20
125
- * }
125
+ * irq: 20,
126
+ * },
126
127
  * },
127
128
  * ]
128
129
  * ```
129
130
  *
130
131
  * `nice` values are POSIX-only. On Windows, the `nice` values of all processors
131
132
  * are always 0.
133
+ *
134
+ * `os.cpus().length` should not be used to calculate the amount of parallelism
135
+ * available to an application. Use {@link availableParallelism} for this purpose.
132
136
  * @since v0.3.3
133
137
  */
134
138
  function cpus(): CpuInfo[];
139
+ /**
140
+ * Returns an estimate of the default amount of parallelism a program should use.
141
+ * Always returns a value greater than zero.
142
+ *
143
+ * This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism).
144
+ * @since v19.4.0, v18.14.0
145
+ */
146
+ function availableParallelism(): number;
135
147
  /**
136
148
  * Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it
137
149
  * returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.
@@ -415,12 +427,11 @@ declare module 'os' {
415
427
  */
416
428
  function platform(): NodeJS.Platform;
417
429
  /**
418
- * Returns the machine type as a string, such as arm, aarch64, mips, mips64, ppc64, ppc64le, s390, s390x, i386, i686, x86_64.
430
+ * Returns the machine type as a string, such as `arm`, `arm64`, `aarch64`,`mips`, `mips64`, `ppc64`, `ppc64le`, `s390`, `s390x`, `i386`, `i686`, `x86_64`.
419
431
  *
420
- * On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname).
421
- * On Windows, `RtlGetVersion()` is used, and if it is not available, `GetVersionExW()` will be used.
422
- * See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
423
- * @since v18.9.0
432
+ * On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not
433
+ * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
434
+ * @since v18.9.0, v16.18.0
424
435
  */
425
436
  function machine(): string;
426
437
  /**