@types/node 18.19.49 → 18.19.50

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 v18.19/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/v18.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 04 Sep 2024 00:28:08 GMT
11
+ * Last updated: Wed, 04 Sep 2024 21:35:57 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node v18.19/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`.
@@ -316,14 +316,14 @@ declare module "http" {
316
316
  }
317
317
  type RequestListener<
318
318
  Request extends typeof IncomingMessage = typeof IncomingMessage,
319
- Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
319
+ Response extends typeof ServerResponse = typeof ServerResponse,
320
320
  > = (req: InstanceType<Request>, res: InstanceType<Response> & { req: InstanceType<Request> }) => void;
321
321
  /**
322
322
  * @since v0.1.17
323
323
  */
324
324
  class Server<
325
325
  Request extends typeof IncomingMessage = typeof IncomingMessage,
326
- Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
326
+ Response extends typeof ServerResponse = typeof ServerResponse,
327
327
  > extends NetServer {
328
328
  constructor(requestListener?: RequestListener<Request, Response>);
329
329
  constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
@@ -1499,11 +1499,11 @@ declare module "http" {
1499
1499
  */
1500
1500
  function createServer<
1501
1501
  Request extends typeof IncomingMessage = typeof IncomingMessage,
1502
- Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
1502
+ Response extends typeof ServerResponse = typeof ServerResponse,
1503
1503
  >(requestListener?: RequestListener<Request, Response>): Server<Request, Response>;
1504
1504
  function createServer<
1505
1505
  Request extends typeof IncomingMessage = typeof IncomingMessage,
1506
- Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
1506
+ Response extends typeof ServerResponse = typeof ServerResponse,
1507
1507
  >(
1508
1508
  options: ServerOptions<Request, Response>,
1509
1509
  requestListener?: RequestListener<Request, Response>,
node v18.19/http2.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The `http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol.
3
- * It can be accessed using:
2
+ * The `http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol. It
3
+ * can be accessed using:
4
4
  *
5
5
  * ```js
6
6
  * const http2 = require('http2');
@@ -96,7 +96,7 @@ declare module "http2" {
96
96
  */
97
97
  readonly endAfterHeaders: boolean;
98
98
  /**
99
- * The numeric stream identifier of this `Http2Stream` instance. Set to `undefined` if the stream identifier has not yet been assigned.
99
+ * The numeric stream identifier of this `Http2Stream` instance. Set to `undefined`if the stream identifier has not yet been assigned.
100
100
  * @since v8.4.0
101
101
  */
102
102
  readonly id?: number | undefined;
@@ -109,7 +109,7 @@ declare module "http2" {
109
109
  /**
110
110
  * Set to the `RST_STREAM` `error code` reported when the `Http2Stream` is
111
111
  * destroyed after either receiving an `RST_STREAM` frame from the connected peer,
112
- * calling `http2stream.close()`, or `http2stream.destroy()`. Will be `undefined` if the `Http2Stream` has not been closed.
112
+ * calling `http2stream.close()`, or `http2stream.destroy()`. Will be`undefined` if the `Http2Stream` has not been closed.
113
113
  * @since v8.4.0
114
114
  */
115
115
  readonly rstCode: number;
@@ -136,7 +136,7 @@ declare module "http2" {
136
136
  */
137
137
  readonly session: Http2Session | undefined;
138
138
  /**
139
- * Provides miscellaneous information about the current state of the `Http2Stream`.
139
+ * Provides miscellaneous information about the current state of the`Http2Stream`.
140
140
  *
141
141
  * A current state of this `Http2Stream`.
142
142
  * @since v8.4.0
@@ -355,7 +355,7 @@ declare module "http2" {
355
355
  /**
356
356
  * Read-only property mapped to the `SETTINGS_ENABLE_PUSH` flag of the remote
357
357
  * client's most recent `SETTINGS` frame. Will be `true` if the remote peer
358
- * accepts push streams, `false` otherwise. Settings are the same for every `Http2Stream` in the same `Http2Session`.
358
+ * accepts push streams, `false` otherwise. Settings are the same for every`Http2Stream` in the same `Http2Session`.
359
359
  * @since v8.4.0
360
360
  */
361
361
  readonly pushAllowed: boolean;
@@ -365,7 +365,7 @@ declare module "http2" {
365
365
  */
366
366
  additionalHeaders(headers: OutgoingHttpHeaders): void;
367
367
  /**
368
- * Initiates a push stream. The callback is invoked with the new `Http2Stream` instance created for the push stream passed as the second argument, or an `Error` passed as the first argument.
368
+ * Initiates a push stream. The callback is invoked with the new `Http2Stream`instance created for the push stream passed as the second argument, or an`Error` passed as the first argument.
369
369
  *
370
370
  * ```js
371
371
  * const http2 = require('http2');
@@ -382,7 +382,7 @@ declare module "http2" {
382
382
  * ```
383
383
  *
384
384
  * Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass
385
- * a `weight` value to `http2stream.priority` with the `silent` option set to `true` to enable server-side bandwidth balancing between concurrent streams.
385
+ * a `weight` value to `http2stream.priority` with the `silent` option set to`true` to enable server-side bandwidth balancing between concurrent streams.
386
386
  *
387
387
  * Calling `http2stream.pushStream()` from within a pushed stream is not permitted
388
388
  * and will throw an error.
@@ -408,12 +408,13 @@ 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
+ * 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
413
+ * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing
414
+ * header fields to the peer.
414
415
  *
415
416
  * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
416
- * close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
417
+ * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
417
418
  *
418
419
  * ```js
419
420
  * const http2 = require('http2');
@@ -450,7 +451,7 @@ declare module "http2" {
450
451
  * const headers = {
451
452
  * 'content-length': stat.size,
452
453
  * 'last-modified': stat.mtime.toUTCString(),
453
- * 'content-type': 'text/plain; charset=utf-8',
454
+ * 'content-type': 'text/plain; charset=utf-8'
454
455
  * };
455
456
  * stream.respondWithFD(fd, headers);
456
457
  * stream.on('close', () => fs.closeSync(fd));
@@ -459,8 +460,8 @@ declare module "http2" {
459
460
  *
460
461
  * The optional `options.statCheck` function may be specified to give user code
461
462
  * 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.
463
+ * of the given fd. If the `statCheck` function is provided, the`http2stream.respondWithFD()` method will perform an `fs.fstat()` call to
464
+ * collect details on the provided file descriptor.
464
465
  *
465
466
  * The `offset` and `length` options may be used to limit the response to a
466
467
  * specific range subset. This can be used, for instance, to support HTTP Range
@@ -478,8 +479,7 @@ declare module "http2" {
478
479
  * header fields to the peer.
479
480
  *
480
481
  * 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`.
482
+ * close when the final `DATA` frame is transmitted. User code _must_ call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
483
483
  *
484
484
  * ```js
485
485
  * const http2 = require('http2');
@@ -493,7 +493,7 @@ declare module "http2" {
493
493
  * const headers = {
494
494
  * 'content-length': stat.size,
495
495
  * 'last-modified': stat.mtime.toUTCString(),
496
- * 'content-type': 'text/plain; charset=utf-8',
496
+ * 'content-type': 'text/plain; charset=utf-8'
497
497
  * };
498
498
  * stream.respondWithFD(fd, headers, { waitForTrailers: true });
499
499
  * stream.on('wantTrailers', () => {
@@ -522,9 +522,9 @@ declare module "http2" {
522
522
  * an opportunity to set additional content headers based on the `fs.Stat` details
523
523
  * of the given file:
524
524
  *
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.
525
+ * 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
526
+ * defined, then it will be called. Otherwise
527
+ * the stream will be destroyed.
528
528
  *
529
529
  * Example using a file path:
530
530
  *
@@ -547,7 +547,7 @@ declare module "http2" {
547
547
  * }
548
548
  * } catch (err) {
549
549
  * // Perform actual error handling.
550
- * console.error(err);
550
+ * console.log(err);
551
551
  * }
552
552
  * stream.end();
553
553
  * }
@@ -560,7 +560,7 @@ declare module "http2" {
560
560
  *
561
561
  * The `options.statCheck` function may also be used to cancel the send operation
562
562
  * by returning `false`. For instance, a conditional request may check the stat
563
- * results to determine if the file has been modified to return an appropriate `304` response:
563
+ * results to determine if the file has been modified to return an appropriate`304` response:
564
564
  *
565
565
  * ```js
566
566
  * const http2 = require('http2');
@@ -648,18 +648,18 @@ declare module "http2" {
648
648
  /**
649
649
  * Value will be `undefined` if the `Http2Session` is not yet connected to a
650
650
  * socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or
651
- * will return the value of the connected `TLSSocket`'s own `alpnProtocol` property.
651
+ * will return the value of the connected `TLSSocket`'s own `alpnProtocol`property.
652
652
  * @since v9.4.0
653
653
  */
654
654
  readonly alpnProtocol?: string | undefined;
655
655
  /**
656
- * Will be `true` if this `Http2Session` instance has been closed, otherwise `false`.
656
+ * Will be `true` if this `Http2Session` instance has been closed, otherwise`false`.
657
657
  * @since v9.4.0
658
658
  */
659
659
  readonly closed: boolean;
660
660
  /**
661
661
  * Will be `true` if this `Http2Session` instance is still connecting, will be set
662
- * to `false` before emitting `connect` event and/or calling the `http2.connect` callback.
662
+ * to `false` before emitting `connect` event and/or calling the `http2.connect`callback.
663
663
  * @since v10.0.0
664
664
  */
665
665
  readonly connecting: boolean;
@@ -678,8 +678,7 @@ declare module "http2" {
678
678
  */
679
679
  readonly encrypted?: boolean | undefined;
680
680
  /**
681
- * A prototype-less object describing the current local settings of this `Http2Session`.
682
- * The local settings are local to _this_`Http2Session` instance.
681
+ * A prototype-less object describing the current local settings of this`Http2Session`. The local settings are local to _this_`Http2Session` instance.
683
682
  * @since v8.4.0
684
683
  */
685
684
  readonly localSettings: Settings;
@@ -694,14 +693,12 @@ declare module "http2" {
694
693
  readonly originSet?: string[] | undefined;
695
694
  /**
696
695
  * 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.
696
+ * 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
697
  * @since v8.4.0
700
698
  */
701
699
  readonly pendingSettingsAck: boolean;
702
700
  /**
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
+ * A prototype-less object describing the current remote settings of this`Http2Session`. The remote settings are set by the _connected_ HTTP/2 peer.
705
702
  * @since v8.4.0
706
703
  */
707
704
  readonly remoteSettings: Settings;
@@ -726,7 +723,7 @@ declare module "http2" {
726
723
  */
727
724
  readonly state: SessionState;
728
725
  /**
729
- * The `http2session.type` will be equal to `http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a
726
+ * The `http2session.type` will be equal to`http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a
730
727
  * server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a
731
728
  * client.
732
729
  * @since v8.4.0
@@ -743,11 +740,11 @@ declare module "http2" {
743
740
  */
744
741
  close(callback?: () => void): void;
745
742
  /**
746
- * Immediately terminates the `Http2Session` and the associated `net.Socket` or `tls.TLSSocket`.
743
+ * Immediately terminates the `Http2Session` and the associated `net.Socket` or`tls.TLSSocket`.
747
744
  *
748
- * Once destroyed, the `Http2Session` will emit the `'close'` event. If `error` is not undefined, an `'error'` event will be emitted immediately before the `'close'` event.
745
+ * Once destroyed, the `Http2Session` will emit the `'close'` event. If `error`is not undefined, an `'error'` event will be emitted immediately before the`'close'` event.
749
746
  *
750
- * If there are any remaining open `Http2Streams` associated with the `Http2Session`, those will also be destroyed.
747
+ * If there are any remaining open `Http2Streams` associated with the`Http2Session`, those will also be destroyed.
751
748
  * @since v8.4.0
752
749
  * @param error An `Error` object if the `Http2Session` is being destroyed due to an error.
753
750
  * @param code The HTTP/2 error code to send in the final `GOAWAY` frame. If unspecified, and `error` is not undefined, the default is `INTERNAL_ERROR`, otherwise defaults to `NO_ERROR`.
@@ -763,9 +760,9 @@ declare module "http2" {
763
760
  goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void;
764
761
  /**
765
762
  * Sends a `PING` frame to the connected HTTP/2 peer. A `callback` function must
766
- * be provided. The method will return `true` if the `PING` was sent, `false` otherwise.
763
+ * be provided. The method will return `true` if the `PING` was sent, `false`otherwise.
767
764
  *
768
- * The maximum number of outstanding (unacknowledged) pings is determined by the `maxOutstandingPings` configuration option. The default maximum is 10.
765
+ * The maximum number of outstanding (unacknowledged) pings is determined by the`maxOutstandingPings` configuration option. The default maximum is 10.
769
766
  *
770
767
  * If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView` containing 8 bytes of data that will be transmitted with the `PING` and
771
768
  * returned with the ping acknowledgment.
@@ -773,7 +770,7 @@ declare module "http2" {
773
770
  * The callback will be invoked with three arguments: an error argument that will
774
771
  * be `null` if the `PING` was successfully acknowledged, a `duration` argument
775
772
  * that reports the number of milliseconds elapsed since the ping was sent and the
776
- * acknowledgment was received, and a `Buffer` containing the 8-byte `PING` payload.
773
+ * acknowledgment was received, and a `Buffer` containing the 8-byte `PING`payload.
777
774
  *
778
775
  * ```js
779
776
  * session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => {
@@ -795,7 +792,7 @@ declare module "http2" {
795
792
  callback: (err: Error | null, duration: number, payload: Buffer) => void,
796
793
  ): boolean;
797
794
  /**
798
- * Calls `ref()` on this `Http2Session` instance's underlying `net.Socket`.
795
+ * Calls `ref()` on this `Http2Session`instance's underlying `net.Socket`.
799
796
  * @since v9.4.0
800
797
  */
801
798
  ref(): void;
@@ -826,9 +823,9 @@ declare module "http2" {
826
823
  */
827
824
  setTimeout(msecs: number, callback?: () => void): void;
828
825
  /**
829
- * Updates the current local settings for this `Http2Session` and sends a new `SETTINGS` frame to the connected HTTP/2 peer.
826
+ * Updates the current local settings for this `Http2Session` and sends a new`SETTINGS` frame to the connected HTTP/2 peer.
830
827
  *
831
- * Once called, the `http2session.pendingSettingsAck` property will be `true` while the session is waiting for the remote peer to acknowledge the new
828
+ * Once called, the `http2session.pendingSettingsAck` property will be `true`while the session is waiting for the remote peer to acknowledge the new
832
829
  * settings.
833
830
  *
834
831
  * The new settings will not become effective until the `SETTINGS` acknowledgment
@@ -921,22 +918,22 @@ declare module "http2" {
921
918
  }
922
919
  export interface ClientHttp2Session extends Http2Session {
923
920
  /**
924
- * For HTTP/2 Client `Http2Session` instances only, the `http2session.request()` creates and returns an `Http2Stream` instance that can be used to send an
921
+ * For HTTP/2 Client `Http2Session` instances only, the `http2session.request()`creates and returns an `Http2Stream` instance that can be used to send an
925
922
  * HTTP/2 request to the connected server.
926
923
  *
927
924
  * When a `ClientHttp2Session` is first created, the socket may not yet be
928
925
  * connected. if `clienthttp2session.request()` is called during this time, the
929
926
  * actual request will be deferred until the socket is ready to go.
930
- * If the `session` is closed before the actual request be executed, an `ERR_HTTP2_GOAWAY_SESSION` is thrown.
927
+ * If the `session` is closed before the actual request be executed, an`ERR_HTTP2_GOAWAY_SESSION` is thrown.
931
928
  *
932
- * This method is only available if `http2session.type` is equal to `http2.constants.NGHTTP2_SESSION_CLIENT`.
929
+ * This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`.
933
930
  *
934
931
  * ```js
935
932
  * const http2 = require('http2');
936
933
  * const clientSession = http2.connect('https://localhost:1234');
937
934
  * const {
938
935
  * HTTP2_HEADER_PATH,
939
- * HTTP2_HEADER_STATUS,
936
+ * HTTP2_HEADER_STATUS
940
937
  * } = http2.constants;
941
938
  *
942
939
  * const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' });
@@ -1052,19 +1049,8 @@ declare module "http2" {
1052
1049
  export interface AlternativeServiceOptions {
1053
1050
  origin: number | string | url.URL;
1054
1051
  }
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>;
1052
+ export interface ServerHttp2Session extends Http2Session {
1053
+ readonly server: Http2Server | Http2SecureServer;
1068
1054
  /**
1069
1055
  * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
1070
1056
  *
@@ -1123,7 +1109,7 @@ declare module "http2" {
1123
1109
  * ```
1124
1110
  *
1125
1111
  * When a string is passed as an `origin`, it will be parsed as a URL and the
1126
- * origin will be derived. For instance, the origin for the HTTP URL `'https://example.org/foo/bar'` is the ASCII string` 'https://example.org'`. An error will be thrown if either the given
1112
+ * origin will be derived. For instance, the origin for the HTTP URL`'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given
1127
1113
  * string
1128
1114
  * cannot be parsed as a URL or if a valid origin cannot be derived.
1129
1115
  *
@@ -1159,30 +1145,17 @@ declare module "http2" {
1159
1145
  ): void;
1160
1146
  addListener(
1161
1147
  event: "connect",
1162
- listener: (
1163
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1164
- socket: net.Socket | tls.TLSSocket,
1165
- ) => void,
1148
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1166
1149
  ): this;
1167
1150
  addListener(
1168
1151
  event: "stream",
1169
1152
  listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
1170
1153
  ): this;
1171
1154
  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;
1155
+ emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
1177
1156
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1178
1157
  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;
1158
+ on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
1186
1159
  on(
1187
1160
  event: "stream",
1188
1161
  listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
@@ -1190,10 +1163,7 @@ declare module "http2" {
1190
1163
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1191
1164
  once(
1192
1165
  event: "connect",
1193
- listener: (
1194
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1195
- socket: net.Socket | tls.TLSSocket,
1196
- ) => void,
1166
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1197
1167
  ): this;
1198
1168
  once(
1199
1169
  event: "stream",
@@ -1202,10 +1172,7 @@ declare module "http2" {
1202
1172
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1203
1173
  prependListener(
1204
1174
  event: "connect",
1205
- listener: (
1206
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1207
- socket: net.Socket | tls.TLSSocket,
1208
- ) => void,
1175
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1209
1176
  ): this;
1210
1177
  prependListener(
1211
1178
  event: "stream",
@@ -1214,10 +1181,7 @@ declare module "http2" {
1214
1181
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1215
1182
  prependOnceListener(
1216
1183
  event: "connect",
1217
- listener: (
1218
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1219
- socket: net.Socket | tls.TLSSocket,
1220
- ) => void,
1184
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1221
1185
  ): this;
1222
1186
  prependOnceListener(
1223
1187
  event: "stream",
@@ -1249,52 +1213,16 @@ declare module "http2" {
1249
1213
  createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined;
1250
1214
  protocol?: "http:" | "https:" | undefined;
1251
1215
  }
1252
- export interface ServerSessionOptions<
1253
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1254
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1255
- InstanceType<Http1Request>
1256
- >,
1257
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1258
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1259
- InstanceType<Http2Request>
1260
- >,
1261
- > extends SessionOptions {
1262
- Http1IncomingMessage?: Http1Request | undefined;
1263
- Http1ServerResponse?: Http1Response | undefined;
1264
- Http2ServerRequest?: Http2Request | undefined;
1265
- 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;
1266
1221
  }
1267
1222
  export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {}
1268
- export interface SecureServerSessionOptions<
1269
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1270
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1271
- InstanceType<Http1Request>
1272
- >,
1273
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1274
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1275
- InstanceType<Http2Request>
1276
- >,
1277
- > extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response>, tls.TlsOptions {}
1278
- export interface ServerOptions<
1279
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1280
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1281
- InstanceType<Http1Request>
1282
- >,
1283
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1284
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1285
- InstanceType<Http2Request>
1286
- >,
1287
- > extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {}
1288
- export interface SecureServerOptions<
1289
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1290
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1291
- InstanceType<Http1Request>
1292
- >,
1293
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1294
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1295
- InstanceType<Http2Request>
1296
- >,
1297
- > 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 {
1298
1226
  allowHTTP1?: boolean | undefined;
1299
1227
  origins?: string[] | undefined;
1300
1228
  }
@@ -1306,28 +1234,16 @@ declare module "http2" {
1306
1234
  */
1307
1235
  updateSettings(settings: Settings): void;
1308
1236
  }
1309
- export interface Http2Server<
1310
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1311
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1312
- InstanceType<Http1Request>
1313
- >,
1314
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1315
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1316
- InstanceType<Http2Request>
1317
- >,
1318
- > extends net.Server, HTTP2ServerCommon {
1237
+ export interface Http2Server extends net.Server, HTTP2ServerCommon {
1319
1238
  addListener(
1320
1239
  event: "checkContinue",
1321
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1240
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1322
1241
  ): this;
1323
1242
  addListener(
1324
1243
  event: "request",
1325
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1326
- ): this;
1327
- addListener(
1328
- event: "session",
1329
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1244
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1330
1245
  ): this;
1246
+ addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1331
1247
  addListener(event: "sessionError", listener: (err: Error) => void): this;
1332
1248
  addListener(
1333
1249
  event: "stream",
@@ -1335,32 +1251,19 @@ declare module "http2" {
1335
1251
  ): this;
1336
1252
  addListener(event: "timeout", listener: () => void): this;
1337
1253
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1338
- emit(
1339
- event: "checkContinue",
1340
- request: InstanceType<Http2Request>,
1341
- response: InstanceType<Http2Response>,
1342
- ): boolean;
1343
- emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
1344
- emit(
1345
- event: "session",
1346
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1347
- ): 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;
1348
1257
  emit(event: "sessionError", err: Error): boolean;
1349
1258
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1350
1259
  emit(event: "timeout"): boolean;
1351
1260
  emit(event: string | symbol, ...args: any[]): boolean;
1352
1261
  on(
1353
1262
  event: "checkContinue",
1354
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1355
- ): this;
1356
- on(
1357
- event: "request",
1358
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1359
- ): this;
1360
- on(
1361
- event: "session",
1362
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1263
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1363
1264
  ): this;
1265
+ on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1266
+ on(event: "session", listener: (session: ServerHttp2Session) => void): this;
1364
1267
  on(event: "sessionError", listener: (err: Error) => void): this;
1365
1268
  on(
1366
1269
  event: "stream",
@@ -1370,16 +1273,10 @@ declare module "http2" {
1370
1273
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1371
1274
  once(
1372
1275
  event: "checkContinue",
1373
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1374
- ): this;
1375
- once(
1376
- event: "request",
1377
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1378
- ): this;
1379
- once(
1380
- event: "session",
1381
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1276
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1382
1277
  ): this;
1278
+ once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1279
+ once(event: "session", listener: (session: ServerHttp2Session) => void): this;
1383
1280
  once(event: "sessionError", listener: (err: Error) => void): this;
1384
1281
  once(
1385
1282
  event: "stream",
@@ -1389,16 +1286,13 @@ declare module "http2" {
1389
1286
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1390
1287
  prependListener(
1391
1288
  event: "checkContinue",
1392
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1289
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1393
1290
  ): this;
1394
1291
  prependListener(
1395
1292
  event: "request",
1396
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1397
- ): this;
1398
- prependListener(
1399
- event: "session",
1400
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1293
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1401
1294
  ): this;
1295
+ prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1402
1296
  prependListener(event: "sessionError", listener: (err: Error) => void): this;
1403
1297
  prependListener(
1404
1298
  event: "stream",
@@ -1408,16 +1302,13 @@ declare module "http2" {
1408
1302
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1409
1303
  prependOnceListener(
1410
1304
  event: "checkContinue",
1411
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1305
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1412
1306
  ): this;
1413
1307
  prependOnceListener(
1414
1308
  event: "request",
1415
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1416
- ): this;
1417
- prependOnceListener(
1418
- event: "session",
1419
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1309
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1420
1310
  ): this;
1311
+ prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1421
1312
  prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
1422
1313
  prependOnceListener(
1423
1314
  event: "stream",
@@ -1426,28 +1317,16 @@ declare module "http2" {
1426
1317
  prependOnceListener(event: "timeout", listener: () => void): this;
1427
1318
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
1428
1319
  }
1429
- export interface Http2SecureServer<
1430
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1431
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1432
- InstanceType<Http1Request>
1433
- >,
1434
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1435
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1436
- InstanceType<Http2Request>
1437
- >,
1438
- > extends tls.Server, HTTP2ServerCommon {
1320
+ export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon {
1439
1321
  addListener(
1440
1322
  event: "checkContinue",
1441
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1323
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1442
1324
  ): this;
1443
1325
  addListener(
1444
1326
  event: "request",
1445
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1446
- ): this;
1447
- addListener(
1448
- event: "session",
1449
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1327
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1450
1328
  ): this;
1329
+ addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1451
1330
  addListener(event: "sessionError", listener: (err: Error) => void): this;
1452
1331
  addListener(
1453
1332
  event: "stream",
@@ -1456,16 +1335,9 @@ declare module "http2" {
1456
1335
  addListener(event: "timeout", listener: () => void): this;
1457
1336
  addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
1458
1337
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1459
- emit(
1460
- event: "checkContinue",
1461
- request: InstanceType<Http2Request>,
1462
- response: InstanceType<Http2Response>,
1463
- ): boolean;
1464
- emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
1465
- emit(
1466
- event: "session",
1467
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1468
- ): 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;
1469
1341
  emit(event: "sessionError", err: Error): boolean;
1470
1342
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1471
1343
  emit(event: "timeout"): boolean;
@@ -1473,16 +1345,10 @@ declare module "http2" {
1473
1345
  emit(event: string | symbol, ...args: any[]): boolean;
1474
1346
  on(
1475
1347
  event: "checkContinue",
1476
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1477
- ): this;
1478
- on(
1479
- event: "request",
1480
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1481
- ): this;
1482
- on(
1483
- event: "session",
1484
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1348
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1485
1349
  ): this;
1350
+ on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1351
+ on(event: "session", listener: (session: ServerHttp2Session) => void): this;
1486
1352
  on(event: "sessionError", listener: (err: Error) => void): this;
1487
1353
  on(
1488
1354
  event: "stream",
@@ -1493,16 +1359,10 @@ declare module "http2" {
1493
1359
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1494
1360
  once(
1495
1361
  event: "checkContinue",
1496
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1497
- ): this;
1498
- once(
1499
- event: "request",
1500
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1501
- ): this;
1502
- once(
1503
- event: "session",
1504
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1362
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1505
1363
  ): this;
1364
+ once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1365
+ once(event: "session", listener: (session: ServerHttp2Session) => void): this;
1506
1366
  once(event: "sessionError", listener: (err: Error) => void): this;
1507
1367
  once(
1508
1368
  event: "stream",
@@ -1513,16 +1373,13 @@ declare module "http2" {
1513
1373
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1514
1374
  prependListener(
1515
1375
  event: "checkContinue",
1516
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1376
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1517
1377
  ): this;
1518
1378
  prependListener(
1519
1379
  event: "request",
1520
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1521
- ): this;
1522
- prependListener(
1523
- event: "session",
1524
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1380
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1525
1381
  ): this;
1382
+ prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1526
1383
  prependListener(event: "sessionError", listener: (err: Error) => void): this;
1527
1384
  prependListener(
1528
1385
  event: "stream",
@@ -1533,16 +1390,13 @@ declare module "http2" {
1533
1390
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1534
1391
  prependOnceListener(
1535
1392
  event: "checkContinue",
1536
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1393
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1537
1394
  ): this;
1538
1395
  prependOnceListener(
1539
1396
  event: "request",
1540
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1541
- ): this;
1542
- prependOnceListener(
1543
- event: "session",
1544
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1397
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1545
1398
  ): this;
1399
+ prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1546
1400
  prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
1547
1401
  prependOnceListener(
1548
1402
  event: "stream",
@@ -1573,7 +1427,7 @@ declare module "http2" {
1573
1427
  readonly aborted: boolean;
1574
1428
  /**
1575
1429
  * The request authority pseudo header field. Because HTTP/2 allows requests
1576
- * to set either `:authority` or `host`, this value is derived from `req.headers[':authority']` if present. Otherwise, it is derived from `req.headers['host']`.
1430
+ * to set either `:authority` or `host`, this value is derived from`req.headers[':authority']` if present. Otherwise, it is derived from`req.headers['host']`.
1577
1431
  * @since v8.4.0
1578
1432
  */
1579
1433
  readonly authority: string;
@@ -1620,9 +1474,9 @@ declare module "http2" {
1620
1474
  readonly headers: IncomingHttpHeaders;
1621
1475
  /**
1622
1476
  * In case of server request, the HTTP version sent by the client. In the case of
1623
- * client response, the HTTP version of the connected-to server. Returns `'2.0'`.
1477
+ * client response, the HTTP version of the connected-to server. Returns`'2.0'`.
1624
1478
  *
1625
- * Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second.
1479
+ * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second.
1626
1480
  * @since v8.4.0
1627
1481
  */
1628
1482
  readonly httpVersion: string;
@@ -1677,11 +1531,11 @@ declare module "http2" {
1677
1531
  * `destroyed`, `readable`, and `writable` properties will be retrieved from and
1678
1532
  * set on `request.stream`.
1679
1533
  *
1680
- * `destroy`, `emit`, `end`, `on` and `once` methods will be called on `request.stream`.
1534
+ * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`request.stream`.
1681
1535
  *
1682
1536
  * `setTimeout` method will be called on `request.stream.session`.
1683
1537
  *
1684
- * `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
1538
+ * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
1685
1539
  * more information.
1686
1540
  *
1687
1541
  * All other interactions will be routed directly to the socket. With TLS support,
@@ -1744,7 +1598,7 @@ declare module "http2" {
1744
1598
  * the response object.
1745
1599
  *
1746
1600
  * If no `'timeout'` listener is added to the request, the response, or
1747
- * the server, then `Http2Stream`s are destroyed when they time out. If a
1601
+ * the server, then `Http2Stream` s are destroyed when they time out. If a
1748
1602
  * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly.
1749
1603
  * @since v8.4.0
1750
1604
  */
@@ -1798,7 +1652,7 @@ declare module "http2" {
1798
1652
  * passed as the second parameter to the `'request'` event.
1799
1653
  * @since v8.4.0
1800
1654
  */
1801
- export class Http2ServerResponse<Request extends Http2ServerRequest = Http2ServerRequest> extends stream.Writable {
1655
+ export class Http2ServerResponse extends stream.Writable {
1802
1656
  constructor(stream: ServerHttp2Stream);
1803
1657
  /**
1804
1658
  * See `response.socket`.
@@ -1819,10 +1673,10 @@ declare module "http2" {
1819
1673
  */
1820
1674
  readonly headersSent: boolean;
1821
1675
  /**
1822
- * A reference to the original HTTP2 `request` object.
1676
+ * A reference to the original HTTP2 request object.
1823
1677
  * @since v15.7.0
1824
1678
  */
1825
- readonly req: Request;
1679
+ readonly req: Http2ServerRequest;
1826
1680
  /**
1827
1681
  * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but
1828
1682
  * applies getters, setters, and methods based on HTTP/2 logic.
@@ -1830,11 +1684,11 @@ declare module "http2" {
1830
1684
  * `destroyed`, `readable`, and `writable` properties will be retrieved from and
1831
1685
  * set on `response.stream`.
1832
1686
  *
1833
- * `destroy`, `emit`, `end`, `on` and `once` methods will be called on `response.stream`.
1687
+ * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`response.stream`.
1834
1688
  *
1835
1689
  * `setTimeout` method will be called on `response.stream.session`.
1836
1690
  *
1837
- * `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
1691
+ * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
1838
1692
  * more information.
1839
1693
  *
1840
1694
  * All other interactions will be routed directly to the socket.
@@ -1938,7 +1792,7 @@ declare module "http2" {
1938
1792
  * header names and the values are the respective header values. All header names
1939
1793
  * are lowercase.
1940
1794
  *
1941
- * The object returned by the `response.getHeaders()` method _does not_ prototypically inherit from the JavaScript `Object`. This means that typical `Object` methods such as `obj.toString()`,
1795
+ * The object returned by the `response.getHeaders()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`,
1942
1796
  * `obj.hasOwnProperty()`, and others
1943
1797
  * are not defined and _will not work_.
1944
1798
  *
@@ -2012,7 +1866,7 @@ declare module "http2" {
2012
1866
  *
2013
1867
  * If no `'timeout'` listener is added to the request, the response, or
2014
1868
  * the server, then `Http2Stream` s are destroyed when they time out. If a
2015
- * handler is assigned to the request, the response, or the server's `'timeout'` events, timed out sockets must be handled explicitly.
1869
+ * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly.
2016
1870
  * @since v8.4.0
2017
1871
  */
2018
1872
  setTimeout(msecs: number, callback?: () => void): void;
@@ -2058,7 +1912,7 @@ declare module "http2" {
2058
1912
  * The `hints` is an object containing the values of headers to be sent with
2059
1913
  * early hints message.
2060
1914
  *
2061
- * **Example**
1915
+ * Example:
2062
1916
  *
2063
1917
  * ```js
2064
1918
  * const earlyHintsLink = '</styles.css>; rel=preload; as=style';
@@ -2072,9 +1926,12 @@ declare module "http2" {
2072
1926
  * ];
2073
1927
  * response.writeEarlyHints({
2074
1928
  * 'link': earlyHintsLinks,
1929
+ * 'x-trace-id': 'id for diagnostics'
2075
1930
  * });
2076
1931
  * ```
1932
+ *
2077
1933
  * @since v18.11.0
1934
+ * @param hints An object containing the values of headers
2078
1935
  */
2079
1936
  writeEarlyHints(hints: Record<string, string | string[]>): void;
2080
1937
  /**
@@ -2099,7 +1956,7 @@ declare module "http2" {
2099
1956
  * `Content-Length` is given in bytes not characters. The`Buffer.byteLength()` API may be used to determine the number of bytes in a
2100
1957
  * given encoding. On outbound messages, Node.js does not check if Content-Length
2101
1958
  * and the length of the body being transmitted are equal or not. However, when
2102
- * receiving messages, Node.js will automatically reject messages when the `Content-Length` does not match the actual payload size.
1959
+ * receiving messages, Node.js will automatically reject messages when the`Content-Length` does not match the actual payload size.
2103
1960
  *
2104
1961
  * This method may be called at most one time on a message before `response.end()` is called.
2105
1962
  *
@@ -2405,7 +2262,7 @@ declare module "http2" {
2405
2262
  */
2406
2263
  export const sensitiveHeaders: symbol;
2407
2264
  /**
2408
- * Returns an object containing the default settings for an `Http2Session` instance. This method returns a new object instance every time it is called
2265
+ * Returns an object containing the default settings for an `Http2Session`instance. This method returns a new object instance every time it is called
2409
2266
  * so instances returned may be safely modified for use.
2410
2267
  * @since v8.4.0
2411
2268
  */
@@ -2434,7 +2291,7 @@ declare module "http2" {
2434
2291
  */
2435
2292
  export function getUnpackedSettings(buf: Uint8Array): Settings;
2436
2293
  /**
2437
- * Returns a `net.Server` instance that creates and manages `Http2Session` instances.
2294
+ * Returns a `net.Server` instance that creates and manages `Http2Session`instances.
2438
2295
  *
2439
2296
  * Since there are no browsers known that support [unencrypted HTTP/2](https://http2.github.io/faq/#does-http2-require-encryption), the use of {@link createSecureServer} is necessary when
2440
2297
  * communicating
@@ -2452,12 +2309,12 @@ declare module "http2" {
2452
2309
  * server.on('stream', (stream, headers) => {
2453
2310
  * stream.respond({
2454
2311
  * 'content-type': 'text/html; charset=utf-8',
2455
- * ':status': 200,
2312
+ * ':status': 200
2456
2313
  * });
2457
2314
  * stream.end('<h1>Hello World</h1>');
2458
2315
  * });
2459
2316
  *
2460
- * server.listen(8000);
2317
+ * server.listen(80);
2461
2318
  * ```
2462
2319
  * @since v8.4.0
2463
2320
  * @param onRequestHandler See `Compatibility API`
@@ -2465,21 +2322,12 @@ declare module "http2" {
2465
2322
  export function createServer(
2466
2323
  onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2467
2324
  ): Http2Server;
2468
- export function createServer<
2469
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
2470
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
2471
- InstanceType<Http1Request>
2472
- >,
2473
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
2474
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
2475
- InstanceType<Http2Request>
2476
- >,
2477
- >(
2478
- options: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
2479
- onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
2480
- ): Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>;
2325
+ export function createServer(
2326
+ options: ServerOptions,
2327
+ onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2328
+ ): Http2Server;
2481
2329
  /**
2482
- * Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
2330
+ * Returns a `tls.Server` instance that creates and manages `Http2Session`instances.
2483
2331
  *
2484
2332
  * ```js
2485
2333
  * const http2 = require('http2');
@@ -2487,7 +2335,7 @@ declare module "http2" {
2487
2335
  *
2488
2336
  * const options = {
2489
2337
  * key: fs.readFileSync('server-key.pem'),
2490
- * cert: fs.readFileSync('server-cert.pem'),
2338
+ * cert: fs.readFileSync('server-cert.pem')
2491
2339
  * };
2492
2340
  *
2493
2341
  * // Create a secure HTTP/2 server
@@ -2496,12 +2344,12 @@ declare module "http2" {
2496
2344
  * server.on('stream', (stream, headers) => {
2497
2345
  * stream.respond({
2498
2346
  * 'content-type': 'text/html; charset=utf-8',
2499
- * ':status': 200,
2347
+ * ':status': 200
2500
2348
  * });
2501
2349
  * stream.end('<h1>Hello World</h1>');
2502
2350
  * });
2503
2351
  *
2504
- * server.listen(8443);
2352
+ * server.listen(80);
2505
2353
  * ```
2506
2354
  * @since v8.4.0
2507
2355
  * @param onRequestHandler See `Compatibility API`
@@ -2509,19 +2357,10 @@ declare module "http2" {
2509
2357
  export function createSecureServer(
2510
2358
  onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2511
2359
  ): Http2SecureServer;
2512
- export function createSecureServer<
2513
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
2514
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
2515
- InstanceType<Http1Request>
2516
- >,
2517
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
2518
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
2519
- InstanceType<Http2Request>
2520
- >,
2521
- >(
2522
- options: SecureServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
2523
- onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
2524
- ): Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>;
2360
+ export function createSecureServer(
2361
+ options: SecureServerOptions,
2362
+ onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2363
+ ): Http2SecureServer;
2525
2364
  /**
2526
2365
  * Returns a `ClientHttp2Session` instance.
2527
2366
  *
node v18.19/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,19 @@ declare module "https" {
125
119
  emit(
126
120
  event: "checkContinue",
127
121
  req: InstanceType<Request>,
128
- res: InstanceType<Response>,
122
+ res: InstanceType<Response> & { req: InstanceType<Request> },
129
123
  ): boolean;
130
124
  emit(
131
125
  event: "checkExpectation",
132
126
  req: InstanceType<Request>,
133
- res: InstanceType<Response>,
127
+ res: InstanceType<Response> & { req: InstanceType<Request> },
134
128
  ): boolean;
135
129
  emit(event: "clientError", err: Error, socket: Duplex): boolean;
136
130
  emit(event: "connect", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
137
131
  emit(
138
132
  event: "request",
139
133
  req: InstanceType<Request>,
140
- res: InstanceType<Response>,
134
+ res: InstanceType<Response> & { req: InstanceType<Request> },
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,15 +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<InstanceType<Request>> = typeof http.ServerResponse<
316
- InstanceType<Request>
317
- >,
309
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
318
310
  >(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
319
311
  function createServer<
320
312
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
321
- Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse<
322
- InstanceType<Request>
323
- >,
313
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
324
314
  >(
325
315
  options: ServerOptions<Request, Response>,
326
316
  requestListener?: http.RequestListener<Request, Response>,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.19.49",
3
+ "version": "18.19.50",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -217,6 +217,6 @@
217
217
  "dependencies": {
218
218
  "undici-types": "~5.26.4"
219
219
  },
220
- "typesPublisherContentHash": "24d0a779b9e50f4a93468e6f68fe1dd999036f683818b114d727cd86ee1d0391",
220
+ "typesPublisherContentHash": "5ce9cffaeee72821d1d992438407df2493e219642e4b4d833ac5a9ef3b70161c",
221
221
  "typeScriptVersion": "4.8"
222
222
  }