@types/node 22.5.3 → 22.5.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 (6) hide show
  1. node/README.md +1 -1
  2. node/http.d.ts +5 -5
  3. node/http2.d.ts +77 -254
  4. node/https.d.ts +14 -18
  5. node/package.json +2 -2
  6. node/util.d.ts +8 -5
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: Wed, 04 Sep 2024 00:28:08 GMT
11
+ * Last updated: Sat, 14 Sep 2024 00:53:13 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
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<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
234
+ Response extends typeof ServerResponse = 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<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
318
+ Response extends typeof ServerResponse = 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<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
325
+ Response extends typeof ServerResponse = 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<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
1556
+ Response extends typeof ServerResponse = 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<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
1560
+ Response extends typeof ServerResponse = 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
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.
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.
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
463
- * perform an `fs.fstat()` call to collect details on the provided file descriptor.
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.
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,8 +478,7 @@ 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()`
482
- * or `http2stream.close()` to close the `Http2Stream`.
481
+ * close when the final `DATA` frame is transmitted. User code _must_ call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
483
482
  *
484
483
  * ```js
485
484
  * const http2 = require('node:http2');
@@ -522,9 +521,9 @@ declare module "http2" {
522
521
  * an opportunity to set additional content headers based on the `fs.Stat` details
523
522
  * of the given file:
524
523
  *
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.
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.
528
527
  *
529
528
  * Example using a file path:
530
529
  *
@@ -678,8 +677,7 @@ declare module "http2" {
678
677
  */
679
678
  readonly encrypted?: boolean | undefined;
680
679
  /**
681
- * A prototype-less object describing the current local settings of this `Http2Session`.
682
- * The local settings are local to _this_`Http2Session` instance.
680
+ * A prototype-less object describing the current local settings of this `Http2Session`. The local settings are local to _this_`Http2Session` instance.
683
681
  * @since v8.4.0
684
682
  */
685
683
  readonly localSettings: Settings;
@@ -694,14 +692,12 @@ declare module "http2" {
694
692
  readonly originSet?: string[] | undefined;
695
693
  /**
696
694
  * Indicates whether the `Http2Session` is currently waiting for acknowledgment of
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.
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.
699
696
  * @since v8.4.0
700
697
  */
701
698
  readonly pendingSettingsAck: boolean;
702
699
  /**
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.
700
+ * A prototype-less object describing the current remote settings of this`Http2Session`. The remote settings are set by the _connected_ HTTP/2 peer.
705
701
  * @since v8.4.0
706
702
  */
707
703
  readonly remoteSettings: Settings;
@@ -1052,19 +1048,8 @@ declare module "http2" {
1052
1048
  export interface AlternativeServiceOptions {
1053
1049
  origin: number | string | url.URL;
1054
1050
  }
1055
- export interface ServerHttp2Session<
1056
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1057
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1058
- InstanceType<Http1Request>
1059
- >,
1060
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1061
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1062
- InstanceType<Http2Request>
1063
- >,
1064
- > extends Http2Session {
1065
- readonly server:
1066
- | Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>
1067
- | Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>;
1051
+ export interface ServerHttp2Session extends Http2Session {
1052
+ readonly server: Http2Server | Http2SecureServer;
1068
1053
  /**
1069
1054
  * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
1070
1055
  *
@@ -1159,30 +1144,17 @@ declare module "http2" {
1159
1144
  ): void;
1160
1145
  addListener(
1161
1146
  event: "connect",
1162
- listener: (
1163
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1164
- socket: net.Socket | tls.TLSSocket,
1165
- ) => void,
1147
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1166
1148
  ): this;
1167
1149
  addListener(
1168
1150
  event: "stream",
1169
1151
  listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
1170
1152
  ): this;
1171
1153
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1172
- emit(
1173
- event: "connect",
1174
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1175
- socket: net.Socket | tls.TLSSocket,
1176
- ): boolean;
1154
+ emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
1177
1155
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1178
1156
  emit(event: string | symbol, ...args: any[]): boolean;
1179
- on(
1180
- event: "connect",
1181
- listener: (
1182
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1183
- socket: net.Socket | tls.TLSSocket,
1184
- ) => void,
1185
- ): this;
1157
+ on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
1186
1158
  on(
1187
1159
  event: "stream",
1188
1160
  listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
@@ -1190,10 +1162,7 @@ declare module "http2" {
1190
1162
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1191
1163
  once(
1192
1164
  event: "connect",
1193
- listener: (
1194
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1195
- socket: net.Socket | tls.TLSSocket,
1196
- ) => void,
1165
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1197
1166
  ): this;
1198
1167
  once(
1199
1168
  event: "stream",
@@ -1202,10 +1171,7 @@ declare module "http2" {
1202
1171
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1203
1172
  prependListener(
1204
1173
  event: "connect",
1205
- listener: (
1206
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1207
- socket: net.Socket | tls.TLSSocket,
1208
- ) => void,
1174
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1209
1175
  ): this;
1210
1176
  prependListener(
1211
1177
  event: "stream",
@@ -1214,10 +1180,7 @@ declare module "http2" {
1214
1180
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1215
1181
  prependOnceListener(
1216
1182
  event: "connect",
1217
- listener: (
1218
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1219
- socket: net.Socket | tls.TLSSocket,
1220
- ) => void,
1183
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1221
1184
  ): this;
1222
1185
  prependOnceListener(
1223
1186
  event: "stream",
@@ -1250,52 +1213,16 @@ declare module "http2" {
1250
1213
  createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined;
1251
1214
  protocol?: "http:" | "https:" | undefined;
1252
1215
  }
1253
- export interface ServerSessionOptions<
1254
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1255
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1256
- InstanceType<Http1Request>
1257
- >,
1258
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1259
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1260
- InstanceType<Http2Request>
1261
- >,
1262
- > extends SessionOptions {
1263
- Http1IncomingMessage?: Http1Request | undefined;
1264
- Http1ServerResponse?: Http1Response | undefined;
1265
- Http2ServerRequest?: Http2Request | undefined;
1266
- Http2ServerResponse?: Http2Response | undefined;
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;
1267
1221
  }
1268
1222
  export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {}
1269
- export interface SecureServerSessionOptions<
1270
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1271
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1272
- InstanceType<Http1Request>
1273
- >,
1274
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1275
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1276
- InstanceType<Http2Request>
1277
- >,
1278
- > extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response>, tls.TlsOptions {}
1279
- export interface ServerOptions<
1280
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1281
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1282
- InstanceType<Http1Request>
1283
- >,
1284
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1285
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1286
- InstanceType<Http2Request>
1287
- >,
1288
- > extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {}
1289
- export interface SecureServerOptions<
1290
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1291
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1292
- InstanceType<Http1Request>
1293
- >,
1294
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1295
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1296
- InstanceType<Http2Request>
1297
- >,
1298
- > extends SecureServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {
1223
+ export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions {}
1224
+ export interface ServerOptions extends ServerSessionOptions {}
1225
+ export interface SecureServerOptions extends SecureServerSessionOptions {
1299
1226
  allowHTTP1?: boolean | undefined;
1300
1227
  origins?: string[] | undefined;
1301
1228
  }
@@ -1307,28 +1234,16 @@ declare module "http2" {
1307
1234
  */
1308
1235
  updateSettings(settings: Settings): void;
1309
1236
  }
1310
- export interface Http2Server<
1311
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1312
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1313
- InstanceType<Http1Request>
1314
- >,
1315
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1316
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1317
- InstanceType<Http2Request>
1318
- >,
1319
- > extends net.Server, HTTP2ServerCommon {
1237
+ export interface Http2Server extends net.Server, HTTP2ServerCommon {
1320
1238
  addListener(
1321
1239
  event: "checkContinue",
1322
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1240
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1323
1241
  ): this;
1324
1242
  addListener(
1325
1243
  event: "request",
1326
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1327
- ): this;
1328
- addListener(
1329
- event: "session",
1330
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1244
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1331
1245
  ): this;
1246
+ addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1332
1247
  addListener(event: "sessionError", listener: (err: Error) => void): this;
1333
1248
  addListener(
1334
1249
  event: "stream",
@@ -1336,32 +1251,19 @@ declare module "http2" {
1336
1251
  ): this;
1337
1252
  addListener(event: "timeout", listener: () => void): this;
1338
1253
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1339
- emit(
1340
- event: "checkContinue",
1341
- request: InstanceType<Http2Request>,
1342
- response: InstanceType<Http2Response>,
1343
- ): boolean;
1344
- emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
1345
- emit(
1346
- event: "session",
1347
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1348
- ): boolean;
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;
1349
1257
  emit(event: "sessionError", err: Error): boolean;
1350
1258
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1351
1259
  emit(event: "timeout"): boolean;
1352
1260
  emit(event: string | symbol, ...args: any[]): boolean;
1353
1261
  on(
1354
1262
  event: "checkContinue",
1355
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1356
- ): this;
1357
- on(
1358
- event: "request",
1359
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1360
- ): this;
1361
- on(
1362
- event: "session",
1363
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1263
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1364
1264
  ): this;
1265
+ on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1266
+ on(event: "session", listener: (session: ServerHttp2Session) => void): this;
1365
1267
  on(event: "sessionError", listener: (err: Error) => void): this;
1366
1268
  on(
1367
1269
  event: "stream",
@@ -1371,16 +1273,10 @@ declare module "http2" {
1371
1273
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1372
1274
  once(
1373
1275
  event: "checkContinue",
1374
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1375
- ): this;
1376
- once(
1377
- event: "request",
1378
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1379
- ): this;
1380
- once(
1381
- event: "session",
1382
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1276
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1383
1277
  ): this;
1278
+ once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1279
+ once(event: "session", listener: (session: ServerHttp2Session) => void): this;
1384
1280
  once(event: "sessionError", listener: (err: Error) => void): this;
1385
1281
  once(
1386
1282
  event: "stream",
@@ -1390,16 +1286,13 @@ declare module "http2" {
1390
1286
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1391
1287
  prependListener(
1392
1288
  event: "checkContinue",
1393
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1289
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1394
1290
  ): this;
1395
1291
  prependListener(
1396
1292
  event: "request",
1397
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1398
- ): this;
1399
- prependListener(
1400
- event: "session",
1401
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1293
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1402
1294
  ): this;
1295
+ prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1403
1296
  prependListener(event: "sessionError", listener: (err: Error) => void): this;
1404
1297
  prependListener(
1405
1298
  event: "stream",
@@ -1409,16 +1302,13 @@ declare module "http2" {
1409
1302
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1410
1303
  prependOnceListener(
1411
1304
  event: "checkContinue",
1412
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1305
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1413
1306
  ): this;
1414
1307
  prependOnceListener(
1415
1308
  event: "request",
1416
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1417
- ): this;
1418
- prependOnceListener(
1419
- event: "session",
1420
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1309
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1421
1310
  ): this;
1311
+ prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1422
1312
  prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
1423
1313
  prependOnceListener(
1424
1314
  event: "stream",
@@ -1427,28 +1317,16 @@ declare module "http2" {
1427
1317
  prependOnceListener(event: "timeout", listener: () => void): this;
1428
1318
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
1429
1319
  }
1430
- export interface Http2SecureServer<
1431
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1432
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1433
- InstanceType<Http1Request>
1434
- >,
1435
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1436
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1437
- InstanceType<Http2Request>
1438
- >,
1439
- > extends tls.Server, HTTP2ServerCommon {
1320
+ export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon {
1440
1321
  addListener(
1441
1322
  event: "checkContinue",
1442
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1323
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1443
1324
  ): this;
1444
1325
  addListener(
1445
1326
  event: "request",
1446
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1447
- ): this;
1448
- addListener(
1449
- event: "session",
1450
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1327
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1451
1328
  ): this;
1329
+ addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1452
1330
  addListener(event: "sessionError", listener: (err: Error) => void): this;
1453
1331
  addListener(
1454
1332
  event: "stream",
@@ -1457,16 +1335,9 @@ declare module "http2" {
1457
1335
  addListener(event: "timeout", listener: () => void): this;
1458
1336
  addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
1459
1337
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1460
- emit(
1461
- event: "checkContinue",
1462
- request: InstanceType<Http2Request>,
1463
- response: InstanceType<Http2Response>,
1464
- ): boolean;
1465
- emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
1466
- emit(
1467
- event: "session",
1468
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1469
- ): boolean;
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;
1470
1341
  emit(event: "sessionError", err: Error): boolean;
1471
1342
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1472
1343
  emit(event: "timeout"): boolean;
@@ -1474,16 +1345,10 @@ declare module "http2" {
1474
1345
  emit(event: string | symbol, ...args: any[]): boolean;
1475
1346
  on(
1476
1347
  event: "checkContinue",
1477
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1478
- ): this;
1479
- on(
1480
- event: "request",
1481
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1482
- ): this;
1483
- on(
1484
- event: "session",
1485
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1348
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1486
1349
  ): this;
1350
+ on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1351
+ on(event: "session", listener: (session: ServerHttp2Session) => void): this;
1487
1352
  on(event: "sessionError", listener: (err: Error) => void): this;
1488
1353
  on(
1489
1354
  event: "stream",
@@ -1494,16 +1359,10 @@ declare module "http2" {
1494
1359
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1495
1360
  once(
1496
1361
  event: "checkContinue",
1497
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1498
- ): this;
1499
- once(
1500
- event: "request",
1501
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1502
- ): this;
1503
- once(
1504
- event: "session",
1505
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1362
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1506
1363
  ): this;
1364
+ once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1365
+ once(event: "session", listener: (session: ServerHttp2Session) => void): this;
1507
1366
  once(event: "sessionError", listener: (err: Error) => void): this;
1508
1367
  once(
1509
1368
  event: "stream",
@@ -1514,16 +1373,13 @@ declare module "http2" {
1514
1373
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1515
1374
  prependListener(
1516
1375
  event: "checkContinue",
1517
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1376
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1518
1377
  ): this;
1519
1378
  prependListener(
1520
1379
  event: "request",
1521
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1522
- ): this;
1523
- prependListener(
1524
- event: "session",
1525
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1380
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1526
1381
  ): this;
1382
+ prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1527
1383
  prependListener(event: "sessionError", listener: (err: Error) => void): this;
1528
1384
  prependListener(
1529
1385
  event: "stream",
@@ -1534,16 +1390,13 @@ declare module "http2" {
1534
1390
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1535
1391
  prependOnceListener(
1536
1392
  event: "checkContinue",
1537
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1393
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1538
1394
  ): this;
1539
1395
  prependOnceListener(
1540
1396
  event: "request",
1541
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1542
- ): this;
1543
- prependOnceListener(
1544
- event: "session",
1545
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1397
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1546
1398
  ): this;
1399
+ prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1547
1400
  prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
1548
1401
  prependOnceListener(
1549
1402
  event: "stream",
@@ -1799,7 +1652,7 @@ declare module "http2" {
1799
1652
  * passed as the second parameter to the `'request'` event.
1800
1653
  * @since v8.4.0
1801
1654
  */
1802
- export class Http2ServerResponse<Request extends Http2ServerRequest = Http2ServerRequest> extends stream.Writable {
1655
+ export class Http2ServerResponse extends stream.Writable {
1803
1656
  constructor(stream: ServerHttp2Stream);
1804
1657
  /**
1805
1658
  * See `response.socket`.
@@ -1845,7 +1698,7 @@ declare module "http2" {
1845
1698
  * A reference to the original HTTP2 `request` object.
1846
1699
  * @since v15.7.0
1847
1700
  */
1848
- readonly req: Request;
1701
+ readonly req: Http2ServerRequest;
1849
1702
  /**
1850
1703
  * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but
1851
1704
  * applies getters, setters, and methods based on HTTP/2 logic.
@@ -2488,19 +2341,10 @@ declare module "http2" {
2488
2341
  export function createServer(
2489
2342
  onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2490
2343
  ): Http2Server;
2491
- export function createServer<
2492
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
2493
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
2494
- InstanceType<Http1Request>
2495
- >,
2496
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
2497
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
2498
- InstanceType<Http2Request>
2499
- >,
2500
- >(
2501
- options: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
2502
- onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
2503
- ): Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>;
2344
+ export function createServer(
2345
+ options: ServerOptions,
2346
+ onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2347
+ ): Http2Server;
2504
2348
  /**
2505
2349
  * Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
2506
2350
  *
@@ -2532,19 +2376,10 @@ declare module "http2" {
2532
2376
  export function createSecureServer(
2533
2377
  onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2534
2378
  ): Http2SecureServer;
2535
- export function createSecureServer<
2536
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
2537
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
2538
- InstanceType<Http1Request>
2539
- >,
2540
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
2541
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
2542
- InstanceType<Http2Request>
2543
- >,
2544
- >(
2545
- options: SecureServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
2546
- onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
2547
- ): Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>;
2379
+ export function createSecureServer(
2380
+ options: SecureServerOptions,
2381
+ onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2382
+ ): Http2SecureServer;
2548
2383
  /**
2549
2384
  * Returns a `ClientHttp2Session` instance.
2550
2385
  *
@@ -2576,19 +2411,7 @@ declare module "http2" {
2576
2411
  * @param options Any `{@link createServer}` options can be provided.
2577
2412
  * @since v20.12.0
2578
2413
  */
2579
- export function performServerHandshake<
2580
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
2581
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
2582
- InstanceType<Http1Request>
2583
- >,
2584
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
2585
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
2586
- InstanceType<Http2Request>
2587
- >,
2588
- >(
2589
- socket: stream.Duplex,
2590
- options?: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
2591
- ): ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>;
2414
+ export function performServerHandshake(socket: stream.Duplex, options?: ServerOptions): ServerHttp2Session;
2592
2415
  }
2593
2416
  declare module "node:http2" {
2594
2417
  export * from "http2";
node/https.d.ts CHANGED
@@ -10,9 +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<InstanceType<Request>> = typeof http.ServerResponse<
14
- InstanceType<Request>
15
- >,
13
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
16
14
  > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>;
17
15
  type RequestOptions =
18
16
  & http.RequestOptions
@@ -36,9 +34,7 @@ declare module "https" {
36
34
  }
37
35
  interface Server<
38
36
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
39
- Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse<
40
- InstanceType<Request>
41
- >,
37
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
42
38
  > extends http.Server<Request, Response> {}
43
39
  /**
44
40
  * See `http.Server` for more information.
@@ -46,9 +42,7 @@ declare module "https" {
46
42
  */
47
43
  class Server<
48
44
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
49
- Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse<
50
- InstanceType<Request>
51
- >,
45
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
52
46
  > extends tls.Server {
53
47
  constructor(requestListener?: http.RequestListener<Request, Response>);
54
48
  constructor(
@@ -125,19 +119,25 @@ declare module "https" {
125
119
  emit(
126
120
  event: "checkContinue",
127
121
  req: InstanceType<Request>,
128
- res: InstanceType<Response>,
122
+ res: InstanceType<Response> & {
123
+ req: InstanceType<Request>;
124
+ },
129
125
  ): boolean;
130
126
  emit(
131
127
  event: "checkExpectation",
132
128
  req: InstanceType<Request>,
133
- res: InstanceType<Response>,
129
+ res: InstanceType<Response> & {
130
+ req: InstanceType<Request>;
131
+ },
134
132
  ): boolean;
135
133
  emit(event: "clientError", err: Error, socket: Duplex): boolean;
136
134
  emit(event: "connect", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
137
135
  emit(
138
136
  event: "request",
139
137
  req: InstanceType<Request>,
140
- res: InstanceType<Response>,
138
+ res: InstanceType<Response> & {
139
+ req: InstanceType<Request>;
140
+ },
141
141
  ): boolean;
142
142
  emit(event: "upgrade", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
143
143
  on(event: string, listener: (...args: any[]) => void): this;
@@ -312,15 +312,11 @@ declare module "https" {
312
312
  */
313
313
  function createServer<
314
314
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
315
- Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse<
316
- InstanceType<Request>
317
- >,
315
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
318
316
  >(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
319
317
  function createServer<
320
318
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
321
- Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse<
322
- InstanceType<Request>
323
- >,
319
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
324
320
  >(
325
321
  options: ServerOptions<Request, Response>,
326
322
  requestListener?: http.RequestListener<Request, Response>,
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.5.3",
3
+ "version": "22.5.5",
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": "b838738b923117466b69f5c6125cb6df5c4b74969e34cc7a05ba64931ea00574",
215
+ "typesPublisherContentHash": "49c6854801c6eca5f0c4debaa90673195b7385ea09dc082e76a86be2fa20430f",
216
216
  "typeScriptVersion": "4.8"
217
217
  }
node/util.d.ts CHANGED
@@ -1520,11 +1520,14 @@ declare module "util" {
1520
1520
  type ParsedValues<T extends ParseArgsConfig> =
1521
1521
  & IfDefaultsTrue<T["strict"], unknown, { [longOption: string]: undefined | string | boolean }>
1522
1522
  & (T["options"] extends ParseArgsOptionsConfig ? {
1523
- -readonly [LongOption in keyof T["options"]]: IfDefaultsFalse<
1524
- T["options"][LongOption]["multiple"],
1525
- undefined | Array<ExtractOptionValue<T, T["options"][LongOption]>>,
1526
- undefined | ExtractOptionValue<T, T["options"][LongOption]>
1527
- >;
1523
+ -readonly [LongOption in keyof T["options"]]:
1524
+ // when "default" is not undefined, the value will be present
1525
+ | (T["options"][LongOption]["default"] extends {} ? never : undefined)
1526
+ | IfDefaultsFalse<
1527
+ T["options"][LongOption]["multiple"],
1528
+ Array<ExtractOptionValue<T, T["options"][LongOption]>>,
1529
+ ExtractOptionValue<T, T["options"][LongOption]>
1530
+ >;
1528
1531
  }
1529
1532
  : {});
1530
1533