@types/node 22.6.1 → 22.7.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.
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (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: Mon, 23 Sep 2024 21:07:32 GMT
11
+ * Last updated: Wed, 25 Sep 2024 00:56:18 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -540,11 +540,11 @@ declare module "diagnostics_channel" {
540
540
  * @param args Optional arguments to pass to the function
541
541
  * @return The return value of the given function
542
542
  */
543
- traceCallback<Fn extends (this: any, ...args: any) => any>(
543
+ traceCallback<Fn extends (this: any, ...args: any[]) => any>(
544
544
  fn: Fn,
545
- position: number | undefined,
546
- context: ContextType | undefined,
547
- thisArg: any,
545
+ position?: number,
546
+ context?: ContextType,
547
+ thisArg?: any,
548
548
  ...args: Parameters<Fn>
549
549
  ): void;
550
550
  }
node/globals.d.ts CHANGED
@@ -168,10 +168,26 @@ declare global {
168
168
  // Same as module.exports
169
169
  var exports: any;
170
170
 
171
+ interface GCFunction {
172
+ (options: {
173
+ execution?: "sync";
174
+ flavor?: "regular" | "last-resort";
175
+ type?: "major-snapshot" | "major" | "minor";
176
+ filename?: string;
177
+ }): void;
178
+ (options: {
179
+ execution: "async";
180
+ flavor?: "regular" | "last-resort";
181
+ type?: "major-snapshot" | "major" | "minor";
182
+ filename?: string;
183
+ }): Promise<void>;
184
+ (options?: boolean): void;
185
+ }
186
+
171
187
  /**
172
188
  * Only available if `--expose-gc` is passed to the process.
173
189
  */
174
- var gc: undefined | (() => void);
190
+ var gc: undefined | GCFunction;
175
191
 
176
192
  // #region borrowed
177
193
  // from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
node/http.d.ts CHANGED
@@ -231,7 +231,7 @@ declare module "http" {
231
231
  }
232
232
  interface ServerOptions<
233
233
  Request extends typeof IncomingMessage = typeof IncomingMessage,
234
- Response extends typeof ServerResponse = typeof ServerResponse,
234
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
235
235
  > {
236
236
  /**
237
237
  * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`.
@@ -315,14 +315,14 @@ declare module "http" {
315
315
  }
316
316
  type RequestListener<
317
317
  Request extends typeof IncomingMessage = typeof IncomingMessage,
318
- Response extends typeof ServerResponse = typeof ServerResponse,
318
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
319
319
  > = (req: InstanceType<Request>, res: InstanceType<Response> & { req: InstanceType<Request> }) => void;
320
320
  /**
321
321
  * @since v0.1.17
322
322
  */
323
323
  class Server<
324
324
  Request extends typeof IncomingMessage = typeof IncomingMessage,
325
- Response extends typeof ServerResponse = typeof ServerResponse,
325
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
326
326
  > extends NetServer {
327
327
  constructor(requestListener?: RequestListener<Request, Response>);
328
328
  constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
@@ -1553,11 +1553,11 @@ declare module "http" {
1553
1553
  */
1554
1554
  function createServer<
1555
1555
  Request extends typeof IncomingMessage = typeof IncomingMessage,
1556
- Response extends typeof ServerResponse = typeof ServerResponse,
1556
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
1557
1557
  >(requestListener?: RequestListener<Request, Response>): Server<Request, Response>;
1558
1558
  function createServer<
1559
1559
  Request extends typeof IncomingMessage = typeof IncomingMessage,
1560
- Response extends typeof ServerResponse = typeof ServerResponse,
1560
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
1561
1561
  >(
1562
1562
  options: ServerOptions<Request, Response>,
1563
1563
  requestListener?: RequestListener<Request, Response>,
node/http2.d.ts CHANGED
@@ -408,9 +408,9 @@ declare module "http2" {
408
408
  * });
409
409
  * ```
410
410
  *
411
- * Initiates a response. When the `options.waitForTrailers` option is set, the`'wantTrailers'` event will be emitted immediately after queuing the last chunk
412
- * of payload data to be sent. The `http2stream.sendTrailers()` method can then be
413
- * used to sent trailing header fields to the peer.
411
+ * Initiates a response. When the `options.waitForTrailers` option is set, the `'wantTrailers'` event
412
+ * will be emitted immediately after queuing the last chunk of payload data to be sent.
413
+ * The `http2stream.sendTrailers()` method can then be used to send trailing header fields to the peer.
414
414
  *
415
415
  * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
416
416
  * close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
@@ -459,8 +459,8 @@ declare module "http2" {
459
459
  *
460
460
  * The optional `options.statCheck` function may be specified to give user code
461
461
  * an opportunity to set additional content headers based on the `fs.Stat` details
462
- * of the given fd. If the `statCheck` function is provided, the `http2stream.respondWithFD()` method will perform an `fs.fstat()` call to
463
- * collect details on the provided file descriptor.
462
+ * of the given fd. If the `statCheck` function is provided, the `http2stream.respondWithFD()` method will
463
+ * perform an `fs.fstat()` call to collect details on the provided file descriptor.
464
464
  *
465
465
  * The `offset` and `length` options may be used to limit the response to a
466
466
  * specific range subset. This can be used, for instance, to support HTTP Range
@@ -478,7 +478,8 @@ declare module "http2" {
478
478
  * header fields to the peer.
479
479
  *
480
480
  * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
481
- * close when the final `DATA` frame is transmitted. User code _must_ call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
481
+ * close when the final `DATA` frame is transmitted. User code _must_ call either `http2stream.sendTrailers()`
482
+ * or `http2stream.close()` to close the `Http2Stream`.
482
483
  *
483
484
  * ```js
484
485
  * const http2 = require('node:http2');
@@ -521,9 +522,9 @@ declare module "http2" {
521
522
  * an opportunity to set additional content headers based on the `fs.Stat` details
522
523
  * of the given file:
523
524
  *
524
- * If an error occurs while attempting to read the file data, the `Http2Stream` will be closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR` code. If the `onError` callback is
525
- * defined, then it will be called. Otherwise
526
- * the stream will be destroyed.
525
+ * If an error occurs while attempting to read the file data, the `Http2Stream` will be closed using an
526
+ * `RST_STREAM` frame using the standard `INTERNAL_ERROR` code.
527
+ * If the `onError` callback is defined, then it will be called. Otherwise, the stream will be destroyed.
527
528
  *
528
529
  * Example using a file path:
529
530
  *
@@ -677,7 +678,8 @@ declare module "http2" {
677
678
  */
678
679
  readonly encrypted?: boolean | undefined;
679
680
  /**
680
- * A prototype-less object describing the current local settings of this `Http2Session`. The local settings are local to _this_`Http2Session` instance.
681
+ * A prototype-less object describing the current local settings of this `Http2Session`.
682
+ * The local settings are local to _this_`Http2Session` instance.
681
683
  * @since v8.4.0
682
684
  */
683
685
  readonly localSettings: Settings;
@@ -692,12 +694,14 @@ declare module "http2" {
692
694
  readonly originSet?: string[] | undefined;
693
695
  /**
694
696
  * Indicates whether the `Http2Session` is currently waiting for acknowledgment of
695
- * a sent `SETTINGS` frame. Will be `true` after calling the `http2session.settings()` method. Will be `false` once all sent `SETTINGS` frames have been acknowledged.
697
+ * a sent `SETTINGS` frame. Will be `true` after calling the `http2session.settings()` method.
698
+ * Will be `false` once all sent `SETTINGS` frames have been acknowledged.
696
699
  * @since v8.4.0
697
700
  */
698
701
  readonly pendingSettingsAck: boolean;
699
702
  /**
700
- * A prototype-less object describing the current remote settings of this`Http2Session`. The remote settings are set by the _connected_ HTTP/2 peer.
703
+ * A prototype-less object describing the current remote settings of this`Http2Session`.
704
+ * The remote settings are set by the _connected_ HTTP/2 peer.
701
705
  * @since v8.4.0
702
706
  */
703
707
  readonly remoteSettings: Settings;
@@ -1048,8 +1052,15 @@ declare module "http2" {
1048
1052
  export interface AlternativeServiceOptions {
1049
1053
  origin: number | string | url.URL;
1050
1054
  }
1051
- export interface ServerHttp2Session extends Http2Session {
1052
- readonly server: Http2Server | Http2SecureServer;
1055
+ export interface ServerHttp2Session<
1056
+ Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1057
+ Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
1058
+ Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1059
+ Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
1060
+ > extends Http2Session {
1061
+ readonly server:
1062
+ | Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>
1063
+ | Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>;
1053
1064
  /**
1054
1065
  * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
1055
1066
  *
@@ -1144,17 +1155,30 @@ declare module "http2" {
1144
1155
  ): void;
1145
1156
  addListener(
1146
1157
  event: "connect",
1147
- listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1158
+ listener: (
1159
+ session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1160
+ socket: net.Socket | tls.TLSSocket,
1161
+ ) => void,
1148
1162
  ): this;
1149
1163
  addListener(
1150
1164
  event: "stream",
1151
1165
  listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
1152
1166
  ): this;
1153
1167
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1154
- emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
1168
+ emit(
1169
+ event: "connect",
1170
+ session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1171
+ socket: net.Socket | tls.TLSSocket,
1172
+ ): boolean;
1155
1173
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1156
1174
  emit(event: string | symbol, ...args: any[]): boolean;
1157
- on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
1175
+ on(
1176
+ event: "connect",
1177
+ listener: (
1178
+ session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1179
+ socket: net.Socket | tls.TLSSocket,
1180
+ ) => void,
1181
+ ): this;
1158
1182
  on(
1159
1183
  event: "stream",
1160
1184
  listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
@@ -1162,7 +1186,10 @@ declare module "http2" {
1162
1186
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1163
1187
  once(
1164
1188
  event: "connect",
1165
- listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1189
+ listener: (
1190
+ session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1191
+ socket: net.Socket | tls.TLSSocket,
1192
+ ) => void,
1166
1193
  ): this;
1167
1194
  once(
1168
1195
  event: "stream",
@@ -1171,7 +1198,10 @@ declare module "http2" {
1171
1198
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1172
1199
  prependListener(
1173
1200
  event: "connect",
1174
- listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1201
+ listener: (
1202
+ session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1203
+ socket: net.Socket | tls.TLSSocket,
1204
+ ) => void,
1175
1205
  ): this;
1176
1206
  prependListener(
1177
1207
  event: "stream",
@@ -1180,7 +1210,10 @@ declare module "http2" {
1180
1210
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1181
1211
  prependOnceListener(
1182
1212
  event: "connect",
1183
- listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1213
+ listener: (
1214
+ session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1215
+ socket: net.Socket | tls.TLSSocket,
1216
+ ) => void,
1184
1217
  ): this;
1185
1218
  prependOnceListener(
1186
1219
  event: "stream",
@@ -1213,16 +1246,36 @@ declare module "http2" {
1213
1246
  createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined;
1214
1247
  protocol?: "http:" | "https:" | undefined;
1215
1248
  }
1216
- export interface ServerSessionOptions extends SessionOptions {
1217
- Http1IncomingMessage?: typeof IncomingMessage | undefined;
1218
- Http1ServerResponse?: typeof ServerResponse | undefined;
1219
- Http2ServerRequest?: typeof Http2ServerRequest | undefined;
1220
- Http2ServerResponse?: typeof Http2ServerResponse | undefined;
1249
+ export interface ServerSessionOptions<
1250
+ Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1251
+ Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
1252
+ Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1253
+ Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
1254
+ > extends SessionOptions {
1255
+ Http1IncomingMessage?: Http1Request | undefined;
1256
+ Http1ServerResponse?: Http1Response | undefined;
1257
+ Http2ServerRequest?: Http2Request | undefined;
1258
+ Http2ServerResponse?: Http2Response | undefined;
1221
1259
  }
1222
1260
  export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {}
1223
- export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions {}
1224
- export interface ServerOptions extends ServerSessionOptions {}
1225
- export interface SecureServerOptions extends SecureServerSessionOptions {
1261
+ export interface SecureServerSessionOptions<
1262
+ Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1263
+ Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
1264
+ Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1265
+ Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
1266
+ > extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response>, tls.TlsOptions {}
1267
+ export interface ServerOptions<
1268
+ Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1269
+ Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
1270
+ Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1271
+ Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
1272
+ > extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {}
1273
+ export interface SecureServerOptions<
1274
+ Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1275
+ Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
1276
+ Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1277
+ Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
1278
+ > extends SecureServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {
1226
1279
  allowHTTP1?: boolean | undefined;
1227
1280
  origins?: string[] | undefined;
1228
1281
  }
@@ -1234,16 +1287,24 @@ declare module "http2" {
1234
1287
  */
1235
1288
  updateSettings(settings: Settings): void;
1236
1289
  }
1237
- export interface Http2Server extends net.Server, HTTP2ServerCommon {
1290
+ export interface Http2Server<
1291
+ Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1292
+ Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
1293
+ Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1294
+ Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
1295
+ > extends net.Server, HTTP2ServerCommon {
1238
1296
  addListener(
1239
1297
  event: "checkContinue",
1240
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1298
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1241
1299
  ): this;
1242
1300
  addListener(
1243
1301
  event: "request",
1244
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1302
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1303
+ ): this;
1304
+ addListener(
1305
+ event: "session",
1306
+ listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1245
1307
  ): this;
1246
- addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1247
1308
  addListener(event: "sessionError", listener: (err: Error) => void): this;
1248
1309
  addListener(
1249
1310
  event: "stream",
@@ -1251,19 +1312,32 @@ declare module "http2" {
1251
1312
  ): this;
1252
1313
  addListener(event: "timeout", listener: () => void): this;
1253
1314
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1254
- emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
1255
- emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
1256
- emit(event: "session", session: ServerHttp2Session): boolean;
1315
+ emit(
1316
+ event: "checkContinue",
1317
+ request: InstanceType<Http2Request>,
1318
+ response: InstanceType<Http2Response>,
1319
+ ): boolean;
1320
+ emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
1321
+ emit(
1322
+ event: "session",
1323
+ session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1324
+ ): boolean;
1257
1325
  emit(event: "sessionError", err: Error): boolean;
1258
1326
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1259
1327
  emit(event: "timeout"): boolean;
1260
1328
  emit(event: string | symbol, ...args: any[]): boolean;
1261
1329
  on(
1262
1330
  event: "checkContinue",
1263
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1331
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1332
+ ): this;
1333
+ on(
1334
+ event: "request",
1335
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1336
+ ): this;
1337
+ on(
1338
+ event: "session",
1339
+ listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1264
1340
  ): this;
1265
- on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1266
- on(event: "session", listener: (session: ServerHttp2Session) => void): this;
1267
1341
  on(event: "sessionError", listener: (err: Error) => void): this;
1268
1342
  on(
1269
1343
  event: "stream",
@@ -1273,10 +1347,16 @@ declare module "http2" {
1273
1347
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1274
1348
  once(
1275
1349
  event: "checkContinue",
1276
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1350
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1351
+ ): this;
1352
+ once(
1353
+ event: "request",
1354
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1355
+ ): this;
1356
+ once(
1357
+ event: "session",
1358
+ listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1277
1359
  ): this;
1278
- once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1279
- once(event: "session", listener: (session: ServerHttp2Session) => void): this;
1280
1360
  once(event: "sessionError", listener: (err: Error) => void): this;
1281
1361
  once(
1282
1362
  event: "stream",
@@ -1286,13 +1366,16 @@ declare module "http2" {
1286
1366
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1287
1367
  prependListener(
1288
1368
  event: "checkContinue",
1289
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1369
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1290
1370
  ): this;
1291
1371
  prependListener(
1292
1372
  event: "request",
1293
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1373
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1374
+ ): this;
1375
+ prependListener(
1376
+ event: "session",
1377
+ listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1294
1378
  ): this;
1295
- prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1296
1379
  prependListener(event: "sessionError", listener: (err: Error) => void): this;
1297
1380
  prependListener(
1298
1381
  event: "stream",
@@ -1302,13 +1385,16 @@ declare module "http2" {
1302
1385
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1303
1386
  prependOnceListener(
1304
1387
  event: "checkContinue",
1305
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1388
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1306
1389
  ): this;
1307
1390
  prependOnceListener(
1308
1391
  event: "request",
1309
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1392
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1393
+ ): this;
1394
+ prependOnceListener(
1395
+ event: "session",
1396
+ listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1310
1397
  ): this;
1311
- prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1312
1398
  prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
1313
1399
  prependOnceListener(
1314
1400
  event: "stream",
@@ -1317,16 +1403,24 @@ declare module "http2" {
1317
1403
  prependOnceListener(event: "timeout", listener: () => void): this;
1318
1404
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
1319
1405
  }
1320
- export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon {
1406
+ export interface Http2SecureServer<
1407
+ Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1408
+ Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
1409
+ Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1410
+ Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
1411
+ > extends tls.Server, HTTP2ServerCommon {
1321
1412
  addListener(
1322
1413
  event: "checkContinue",
1323
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1414
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1324
1415
  ): this;
1325
1416
  addListener(
1326
1417
  event: "request",
1327
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1418
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1419
+ ): this;
1420
+ addListener(
1421
+ event: "session",
1422
+ listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1328
1423
  ): this;
1329
- addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1330
1424
  addListener(event: "sessionError", listener: (err: Error) => void): this;
1331
1425
  addListener(
1332
1426
  event: "stream",
@@ -1335,9 +1429,16 @@ declare module "http2" {
1335
1429
  addListener(event: "timeout", listener: () => void): this;
1336
1430
  addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
1337
1431
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1338
- emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
1339
- emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
1340
- emit(event: "session", session: ServerHttp2Session): boolean;
1432
+ emit(
1433
+ event: "checkContinue",
1434
+ request: InstanceType<Http2Request>,
1435
+ response: InstanceType<Http2Response>,
1436
+ ): boolean;
1437
+ emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
1438
+ emit(
1439
+ event: "session",
1440
+ session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1441
+ ): boolean;
1341
1442
  emit(event: "sessionError", err: Error): boolean;
1342
1443
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1343
1444
  emit(event: "timeout"): boolean;
@@ -1345,10 +1446,16 @@ declare module "http2" {
1345
1446
  emit(event: string | symbol, ...args: any[]): boolean;
1346
1447
  on(
1347
1448
  event: "checkContinue",
1348
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1449
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1450
+ ): this;
1451
+ on(
1452
+ event: "request",
1453
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1454
+ ): this;
1455
+ on(
1456
+ event: "session",
1457
+ listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1349
1458
  ): this;
1350
- on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1351
- on(event: "session", listener: (session: ServerHttp2Session) => void): this;
1352
1459
  on(event: "sessionError", listener: (err: Error) => void): this;
1353
1460
  on(
1354
1461
  event: "stream",
@@ -1359,10 +1466,16 @@ declare module "http2" {
1359
1466
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1360
1467
  once(
1361
1468
  event: "checkContinue",
1362
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1469
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1470
+ ): this;
1471
+ once(
1472
+ event: "request",
1473
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1474
+ ): this;
1475
+ once(
1476
+ event: "session",
1477
+ listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1363
1478
  ): this;
1364
- once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1365
- once(event: "session", listener: (session: ServerHttp2Session) => void): this;
1366
1479
  once(event: "sessionError", listener: (err: Error) => void): this;
1367
1480
  once(
1368
1481
  event: "stream",
@@ -1373,13 +1486,16 @@ declare module "http2" {
1373
1486
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1374
1487
  prependListener(
1375
1488
  event: "checkContinue",
1376
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1489
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1377
1490
  ): this;
1378
1491
  prependListener(
1379
1492
  event: "request",
1380
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1493
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1494
+ ): this;
1495
+ prependListener(
1496
+ event: "session",
1497
+ listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1381
1498
  ): this;
1382
- prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1383
1499
  prependListener(event: "sessionError", listener: (err: Error) => void): this;
1384
1500
  prependListener(
1385
1501
  event: "stream",
@@ -1390,13 +1506,16 @@ declare module "http2" {
1390
1506
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1391
1507
  prependOnceListener(
1392
1508
  event: "checkContinue",
1393
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1509
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1394
1510
  ): this;
1395
1511
  prependOnceListener(
1396
1512
  event: "request",
1397
- listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1513
+ listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1514
+ ): this;
1515
+ prependOnceListener(
1516
+ event: "session",
1517
+ listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1398
1518
  ): this;
1399
- prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1400
1519
  prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
1401
1520
  prependOnceListener(
1402
1521
  event: "stream",
@@ -1652,7 +1771,7 @@ declare module "http2" {
1652
1771
  * passed as the second parameter to the `'request'` event.
1653
1772
  * @since v8.4.0
1654
1773
  */
1655
- export class Http2ServerResponse extends stream.Writable {
1774
+ export class Http2ServerResponse<Request extends Http2ServerRequest = Http2ServerRequest> extends stream.Writable {
1656
1775
  constructor(stream: ServerHttp2Stream);
1657
1776
  /**
1658
1777
  * See `response.socket`.
@@ -1698,7 +1817,7 @@ declare module "http2" {
1698
1817
  * A reference to the original HTTP2 `request` object.
1699
1818
  * @since v15.7.0
1700
1819
  */
1701
- readonly req: Http2ServerRequest;
1820
+ readonly req: Request;
1702
1821
  /**
1703
1822
  * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but
1704
1823
  * applies getters, setters, and methods based on HTTP/2 logic.
@@ -2341,10 +2460,15 @@ declare module "http2" {
2341
2460
  export function createServer(
2342
2461
  onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2343
2462
  ): Http2Server;
2344
- export function createServer(
2345
- options: ServerOptions,
2346
- onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2347
- ): Http2Server;
2463
+ export function createServer<
2464
+ Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
2465
+ Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
2466
+ Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
2467
+ Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
2468
+ >(
2469
+ options: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
2470
+ onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
2471
+ ): Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>;
2348
2472
  /**
2349
2473
  * Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
2350
2474
  *
@@ -2376,10 +2500,15 @@ declare module "http2" {
2376
2500
  export function createSecureServer(
2377
2501
  onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2378
2502
  ): Http2SecureServer;
2379
- export function createSecureServer(
2380
- options: SecureServerOptions,
2381
- onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2382
- ): Http2SecureServer;
2503
+ export function createSecureServer<
2504
+ Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
2505
+ Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
2506
+ Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
2507
+ Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
2508
+ >(
2509
+ options: SecureServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
2510
+ onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
2511
+ ): Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>;
2383
2512
  /**
2384
2513
  * Returns a `ClientHttp2Session` instance.
2385
2514
  *
@@ -2411,7 +2540,15 @@ declare module "http2" {
2411
2540
  * @param options Any `{@link createServer}` options can be provided.
2412
2541
  * @since v20.12.0
2413
2542
  */
2414
- export function performServerHandshake(socket: stream.Duplex, options?: ServerOptions): ServerHttp2Session;
2543
+ export function performServerHandshake<
2544
+ Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
2545
+ Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
2546
+ Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
2547
+ Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
2548
+ >(
2549
+ socket: stream.Duplex,
2550
+ options?: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
2551
+ ): ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>;
2415
2552
  }
2416
2553
  declare module "node:http2" {
2417
2554
  export * from "http2";
node/https.d.ts CHANGED
@@ -10,7 +10,7 @@ declare module "https" {
10
10
  import { URL } from "node:url";
11
11
  type ServerOptions<
12
12
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
13
- Response extends typeof http.ServerResponse = typeof http.ServerResponse,
13
+ Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
14
14
  > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>;
15
15
  type RequestOptions =
16
16
  & http.RequestOptions
@@ -34,7 +34,7 @@ declare module "https" {
34
34
  }
35
35
  interface Server<
36
36
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
37
- Response extends typeof http.ServerResponse = typeof http.ServerResponse,
37
+ Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
38
38
  > extends http.Server<Request, Response> {}
39
39
  /**
40
40
  * See `http.Server` for more information.
@@ -42,7 +42,7 @@ declare module "https" {
42
42
  */
43
43
  class Server<
44
44
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
45
- Response extends typeof http.ServerResponse = typeof http.ServerResponse,
45
+ Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
46
46
  > extends tls.Server {
47
47
  constructor(requestListener?: http.RequestListener<Request, Response>);
48
48
  constructor(
@@ -119,25 +119,19 @@ declare module "https" {
119
119
  emit(
120
120
  event: "checkContinue",
121
121
  req: InstanceType<Request>,
122
- res: InstanceType<Response> & {
123
- req: InstanceType<Request>;
124
- },
122
+ res: InstanceType<Response>,
125
123
  ): boolean;
126
124
  emit(
127
125
  event: "checkExpectation",
128
126
  req: InstanceType<Request>,
129
- res: InstanceType<Response> & {
130
- req: InstanceType<Request>;
131
- },
127
+ res: InstanceType<Response>,
132
128
  ): boolean;
133
129
  emit(event: "clientError", err: Error, socket: Duplex): boolean;
134
130
  emit(event: "connect", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
135
131
  emit(
136
132
  event: "request",
137
133
  req: InstanceType<Request>,
138
- res: InstanceType<Response> & {
139
- req: InstanceType<Request>;
140
- },
134
+ res: InstanceType<Response>,
141
135
  ): boolean;
142
136
  emit(event: "upgrade", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
143
137
  on(event: string, listener: (...args: any[]) => void): this;
@@ -312,11 +306,11 @@ declare module "https" {
312
306
  */
313
307
  function createServer<
314
308
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
315
- Response extends typeof http.ServerResponse = typeof http.ServerResponse,
309
+ Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
316
310
  >(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
317
311
  function createServer<
318
312
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
319
- Response extends typeof http.ServerResponse = typeof http.ServerResponse,
313
+ Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
320
314
  >(
321
315
  options: ServerOptions<Request, Response>,
322
316
  requestListener?: http.RequestListener<Request, Response>,
node/inspector.d.ts CHANGED
@@ -1704,6 +1704,10 @@ declare module 'inspector' {
1704
1704
  }
1705
1705
  }
1706
1706
  namespace Network {
1707
+ /**
1708
+ * Resource type as it was perceived by the rendering engine.
1709
+ */
1710
+ type ResourceType = string;
1707
1711
  /**
1708
1712
  * Unique request identifier.
1709
1713
  */
@@ -1722,6 +1726,21 @@ declare module 'inspector' {
1722
1726
  interface Request {
1723
1727
  url: string;
1724
1728
  method: string;
1729
+ headers: Headers;
1730
+ }
1731
+ /**
1732
+ * HTTP response data.
1733
+ */
1734
+ interface Response {
1735
+ url: string;
1736
+ status: number;
1737
+ statusText: string;
1738
+ headers: Headers;
1739
+ }
1740
+ /**
1741
+ * Request / response headers as keys / values of JSON object.
1742
+ */
1743
+ interface Headers {
1725
1744
  }
1726
1745
  interface RequestWillBeSentEventDataType {
1727
1746
  /**
@@ -1750,6 +1769,32 @@ declare module 'inspector' {
1750
1769
  * Timestamp.
1751
1770
  */
1752
1771
  timestamp: MonotonicTime;
1772
+ /**
1773
+ * Resource type.
1774
+ */
1775
+ type: ResourceType;
1776
+ /**
1777
+ * Response data.
1778
+ */
1779
+ response: Response;
1780
+ }
1781
+ interface LoadingFailedEventDataType {
1782
+ /**
1783
+ * Request identifier.
1784
+ */
1785
+ requestId: RequestId;
1786
+ /**
1787
+ * Timestamp.
1788
+ */
1789
+ timestamp: MonotonicTime;
1790
+ /**
1791
+ * Resource type.
1792
+ */
1793
+ type: ResourceType;
1794
+ /**
1795
+ * Error message.
1796
+ */
1797
+ errorText: string;
1753
1798
  }
1754
1799
  interface LoadingFinishedEventDataType {
1755
1800
  /**
@@ -2260,6 +2305,7 @@ declare module 'inspector' {
2260
2305
  * Fired when HTTP response is available.
2261
2306
  */
2262
2307
  addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
2308
+ addListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
2263
2309
  addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
2264
2310
  /**
2265
2311
  * This event is fired instead of `Runtime.executionContextDestroyed` when
@@ -2302,6 +2348,7 @@ declare module 'inspector' {
2302
2348
  emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>): boolean;
2303
2349
  emit(event: 'Network.requestWillBeSent', message: InspectorNotification<Network.RequestWillBeSentEventDataType>): boolean;
2304
2350
  emit(event: 'Network.responseReceived', message: InspectorNotification<Network.ResponseReceivedEventDataType>): boolean;
2351
+ emit(event: 'Network.loadingFailed', message: InspectorNotification<Network.LoadingFailedEventDataType>): boolean;
2305
2352
  emit(event: 'Network.loadingFinished', message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
2306
2353
  emit(event: 'NodeRuntime.waitingForDisconnect'): boolean;
2307
2354
  emit(event: 'NodeRuntime.waitingForDebugger'): boolean;
@@ -2408,6 +2455,7 @@ declare module 'inspector' {
2408
2455
  * Fired when HTTP response is available.
2409
2456
  */
2410
2457
  on(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
2458
+ on(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
2411
2459
  on(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
2412
2460
  /**
2413
2461
  * This event is fired instead of `Runtime.executionContextDestroyed` when
@@ -2524,6 +2572,7 @@ declare module 'inspector' {
2524
2572
  * Fired when HTTP response is available.
2525
2573
  */
2526
2574
  once(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
2575
+ once(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
2527
2576
  once(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
2528
2577
  /**
2529
2578
  * This event is fired instead of `Runtime.executionContextDestroyed` when
@@ -2640,6 +2689,7 @@ declare module 'inspector' {
2640
2689
  * Fired when HTTP response is available.
2641
2690
  */
2642
2691
  prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
2692
+ prependListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
2643
2693
  prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
2644
2694
  /**
2645
2695
  * This event is fired instead of `Runtime.executionContextDestroyed` when
@@ -2756,6 +2806,7 @@ declare module 'inspector' {
2756
2806
  * Fired when HTTP response is available.
2757
2807
  */
2758
2808
  prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
2809
+ prependOnceListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
2759
2810
  prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
2760
2811
  /**
2761
2812
  * This event is fired instead of `Runtime.executionContextDestroyed` when
@@ -2853,6 +2904,7 @@ declare module 'inspector' {
2853
2904
  */
2854
2905
  const console: InspectorConsole;
2855
2906
 
2907
+ // DevTools protocol event broadcast methods
2856
2908
  namespace Network {
2857
2909
  /**
2858
2910
  * This feature is only available with the `--experimental-network-inspection` flag enabled.
@@ -2881,6 +2933,15 @@ declare module 'inspector' {
2881
2933
  * @experimental
2882
2934
  */
2883
2935
  function loadingFinished(params: LoadingFinishedEventDataType): void;
2936
+ /**
2937
+ * This feature is only available with the `--experimental-network-inspection` flag enabled.
2938
+ *
2939
+ * Broadcasts the `Network.loadingFailed` event to connected frontends. This event indicates that
2940
+ * HTTP request has failed to load.
2941
+ * @since v22.7.0
2942
+ * @experimental
2943
+ */
2944
+ function loadingFailed(params: LoadingFailedEventDataType): void;
2884
2945
  }
2885
2946
  }
2886
2947
 
@@ -3357,6 +3418,7 @@ declare module 'inspector/promises' {
3357
3418
  * Fired when HTTP response is available.
3358
3419
  */
3359
3420
  addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
3421
+ addListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
3360
3422
  addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
3361
3423
  /**
3362
3424
  * This event is fired instead of `Runtime.executionContextDestroyed` when
@@ -3399,6 +3461,7 @@ declare module 'inspector/promises' {
3399
3461
  emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>): boolean;
3400
3462
  emit(event: 'Network.requestWillBeSent', message: InspectorNotification<Network.RequestWillBeSentEventDataType>): boolean;
3401
3463
  emit(event: 'Network.responseReceived', message: InspectorNotification<Network.ResponseReceivedEventDataType>): boolean;
3464
+ emit(event: 'Network.loadingFailed', message: InspectorNotification<Network.LoadingFailedEventDataType>): boolean;
3402
3465
  emit(event: 'Network.loadingFinished', message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
3403
3466
  emit(event: 'NodeRuntime.waitingForDisconnect'): boolean;
3404
3467
  emit(event: 'NodeRuntime.waitingForDebugger'): boolean;
@@ -3505,6 +3568,7 @@ declare module 'inspector/promises' {
3505
3568
  * Fired when HTTP response is available.
3506
3569
  */
3507
3570
  on(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
3571
+ on(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
3508
3572
  on(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
3509
3573
  /**
3510
3574
  * This event is fired instead of `Runtime.executionContextDestroyed` when
@@ -3621,6 +3685,7 @@ declare module 'inspector/promises' {
3621
3685
  * Fired when HTTP response is available.
3622
3686
  */
3623
3687
  once(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
3688
+ once(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
3624
3689
  once(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
3625
3690
  /**
3626
3691
  * This event is fired instead of `Runtime.executionContextDestroyed` when
@@ -3737,6 +3802,7 @@ declare module 'inspector/promises' {
3737
3802
  * Fired when HTTP response is available.
3738
3803
  */
3739
3804
  prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
3805
+ prependListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
3740
3806
  prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
3741
3807
  /**
3742
3808
  * This event is fired instead of `Runtime.executionContextDestroyed` when
@@ -3853,6 +3919,7 @@ declare module 'inspector/promises' {
3853
3919
  * Fired when HTTP response is available.
3854
3920
  */
3855
3921
  prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
3922
+ prependOnceListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
3856
3923
  prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
3857
3924
  /**
3858
3925
  * This event is fired instead of `Runtime.executionContextDestroyed` when
node/net.d.ts CHANGED
@@ -29,6 +29,7 @@ declare module "net" {
29
29
  interface SocketConstructorOpts {
30
30
  fd?: number | undefined;
31
31
  allowHalfOpen?: boolean | undefined;
32
+ onread?: OnReadOpts | undefined;
32
33
  readable?: boolean | undefined;
33
34
  writable?: boolean | undefined;
34
35
  signal?: AbortSignal;
@@ -37,20 +38,15 @@ declare module "net" {
37
38
  buffer: Uint8Array | (() => Uint8Array);
38
39
  /**
39
40
  * This function is called for every chunk of incoming data.
40
- * Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer.
41
- * Return false from this function to implicitly pause() the socket.
41
+ * Two arguments are passed to it: the number of bytes written to `buffer` and a reference to `buffer`.
42
+ * Return `false` from this function to implicitly `pause()` the socket.
42
43
  */
43
- callback(bytesWritten: number, buf: Uint8Array): boolean;
44
- }
45
- interface ConnectOpts {
46
- /**
47
- * If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket.
48
- * Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will
49
- * still be emitted as normal and methods like pause() and resume() will also behave as expected.
50
- */
51
- onread?: OnReadOpts | undefined;
44
+ callback(bytesWritten: number, buffer: Uint8Array): boolean;
52
45
  }
53
- interface TcpSocketConnectOpts extends ConnectOpts {
46
+ // TODO: remove empty ConnectOpts placeholder at next major @types/node version.
47
+ /** @deprecated */
48
+ interface ConnectOpts {}
49
+ interface TcpSocketConnectOpts {
54
50
  port: number;
55
51
  host?: string | undefined;
56
52
  localAddress?: string | undefined;
@@ -70,7 +66,7 @@ declare module "net" {
70
66
  */
71
67
  autoSelectFamilyAttemptTimeout?: number | undefined;
72
68
  }
73
- interface IpcSocketConnectOpts extends ConnectOpts {
69
+ interface IpcSocketConnectOpts {
74
70
  path: string;
75
71
  }
76
72
  type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.6.1",
3
+ "version": "22.7.0",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -212,6 +212,6 @@
212
212
  "dependencies": {
213
213
  "undici-types": "~6.19.2"
214
214
  },
215
- "typesPublisherContentHash": "1445f8e238b8d2b5072d175305ab08953ef767426c16d5ae023784aefd6098a0",
215
+ "typesPublisherContentHash": "067d27779cf5362265af613cf9443a3b325093b3f6d8f87681436e663d5e5e04",
216
216
  "typeScriptVersion": "4.8"
217
217
  }