@types/node 16.18.107 → 16.18.108

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 v16.18/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/v16.
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: none
13
13
 
14
14
  # Credits
node v16.18/http.d.ts CHANGED
@@ -225,7 +225,7 @@ declare module "http" {
225
225
  }
226
226
  interface ServerOptions<
227
227
  Request extends typeof IncomingMessage = typeof IncomingMessage,
228
- Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
228
+ Response extends typeof ServerResponse = typeof ServerResponse,
229
229
  > {
230
230
  IncomingMessage?: Request | undefined;
231
231
  ServerResponse?: Response | undefined;
@@ -265,14 +265,14 @@ declare module "http" {
265
265
  }
266
266
  type RequestListener<
267
267
  Request extends typeof IncomingMessage = typeof IncomingMessage,
268
- Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
268
+ Response extends typeof ServerResponse = typeof ServerResponse,
269
269
  > = (req: InstanceType<Request>, res: InstanceType<Response> & { req: InstanceType<Request> }) => void;
270
270
  /**
271
271
  * @since v0.1.17
272
272
  */
273
273
  class Server<
274
274
  Request extends typeof IncomingMessage = typeof IncomingMessage,
275
- Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
275
+ Response extends typeof ServerResponse = typeof ServerResponse,
276
276
  > extends NetServer {
277
277
  constructor(requestListener?: RequestListener<Request, Response>);
278
278
  constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
@@ -1287,15 +1287,12 @@ declare module "http" {
1287
1287
  */
1288
1288
  function createServer<
1289
1289
  Request extends typeof IncomingMessage = typeof IncomingMessage,
1290
- Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
1290
+ Response extends typeof ServerResponse = typeof ServerResponse,
1291
1291
  >(requestListener?: RequestListener<Request, Response>): Server<Request, Response>;
1292
1292
  function createServer<
1293
1293
  Request extends typeof IncomingMessage = typeof IncomingMessage,
1294
- Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
1295
- >(
1296
- options: ServerOptions<Request, Response>,
1297
- requestListener?: RequestListener<Request, Response>,
1298
- ): Server<Request, Response>;
1294
+ Response extends typeof ServerResponse = typeof ServerResponse,
1295
+ >(options: ServerOptions, requestListener?: RequestListener<Request, Response>): Server<Request, Response>;
1299
1296
  // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly,
1300
1297
  // create interface RequestOptions would make the naming more clear to developers
1301
1298
  interface RequestOptions extends ClientRequestArgs {}
node v16.18/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;
@@ -815,7 +812,7 @@ declare module "http2" {
815
812
  * session.setLocalWindowSize(expectedWindowSize);
816
813
  * });
817
814
  * ```
818
- * @since v15.3.0, v14.18.0
815
+ * @since v15.3.0
819
816
  */
820
817
  setLocalWindowSize(windowSize: number): void;
821
818
  /**
@@ -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,7 +918,7 @@ 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
  * This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`.
@@ -931,7 +928,7 @@ declare module "http2" {
931
928
  * const clientSession = http2.connect('https://localhost:1234');
932
929
  * const {
933
930
  * HTTP2_HEADER_PATH,
934
- * HTTP2_HEADER_STATUS,
931
+ * HTTP2_HEADER_STATUS
935
932
  * } = http2.constants;
936
933
  *
937
934
  * const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' });
@@ -1047,19 +1044,8 @@ declare module "http2" {
1047
1044
  export interface AlternativeServiceOptions {
1048
1045
  origin: number | string | url.URL;
1049
1046
  }
1050
- export interface ServerHttp2Session<
1051
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1052
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1053
- InstanceType<Http1Request>
1054
- >,
1055
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1056
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1057
- InstanceType<Http2Request>
1058
- >,
1059
- > extends Http2Session {
1060
- readonly server:
1061
- | Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>
1062
- | Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>;
1047
+ export interface ServerHttp2Session extends Http2Session {
1048
+ readonly server: Http2Server | Http2SecureServer;
1063
1049
  /**
1064
1050
  * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
1065
1051
  *
@@ -1118,7 +1104,7 @@ declare module "http2" {
1118
1104
  * ```
1119
1105
  *
1120
1106
  * When a string is passed as an `origin`, it will be parsed as a URL and the
1121
- * 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
1107
+ * 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
1122
1108
  * string
1123
1109
  * cannot be parsed as a URL or if a valid origin cannot be derived.
1124
1110
  *
@@ -1154,30 +1140,17 @@ declare module "http2" {
1154
1140
  ): void;
1155
1141
  addListener(
1156
1142
  event: "connect",
1157
- listener: (
1158
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1159
- socket: net.Socket | tls.TLSSocket,
1160
- ) => void,
1143
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1161
1144
  ): this;
1162
1145
  addListener(
1163
1146
  event: "stream",
1164
1147
  listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
1165
1148
  ): this;
1166
1149
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1167
- emit(
1168
- event: "connect",
1169
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1170
- socket: net.Socket | tls.TLSSocket,
1171
- ): boolean;
1150
+ emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
1172
1151
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1173
1152
  emit(event: string | symbol, ...args: any[]): boolean;
1174
- on(
1175
- event: "connect",
1176
- listener: (
1177
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1178
- socket: net.Socket | tls.TLSSocket,
1179
- ) => void,
1180
- ): this;
1153
+ on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
1181
1154
  on(
1182
1155
  event: "stream",
1183
1156
  listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
@@ -1185,10 +1158,7 @@ declare module "http2" {
1185
1158
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1186
1159
  once(
1187
1160
  event: "connect",
1188
- listener: (
1189
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1190
- socket: net.Socket | tls.TLSSocket,
1191
- ) => void,
1161
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1192
1162
  ): this;
1193
1163
  once(
1194
1164
  event: "stream",
@@ -1197,10 +1167,7 @@ declare module "http2" {
1197
1167
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1198
1168
  prependListener(
1199
1169
  event: "connect",
1200
- listener: (
1201
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1202
- socket: net.Socket | tls.TLSSocket,
1203
- ) => void,
1170
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1204
1171
  ): this;
1205
1172
  prependListener(
1206
1173
  event: "stream",
@@ -1209,10 +1176,7 @@ declare module "http2" {
1209
1176
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1210
1177
  prependOnceListener(
1211
1178
  event: "connect",
1212
- listener: (
1213
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1214
- socket: net.Socket | tls.TLSSocket,
1215
- ) => void,
1179
+ listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
1216
1180
  ): this;
1217
1181
  prependOnceListener(
1218
1182
  event: "stream",
@@ -1244,52 +1208,16 @@ declare module "http2" {
1244
1208
  createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined;
1245
1209
  protocol?: "http:" | "https:" | undefined;
1246
1210
  }
1247
- export interface ServerSessionOptions<
1248
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1249
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1250
- InstanceType<Http1Request>
1251
- >,
1252
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1253
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1254
- InstanceType<Http2Request>
1255
- >,
1256
- > extends SessionOptions {
1257
- Http1IncomingMessage?: Http1Request | undefined;
1258
- Http1ServerResponse?: Http1Response | undefined;
1259
- Http2ServerRequest?: Http2Request | undefined;
1260
- Http2ServerResponse?: Http2Response | undefined;
1211
+ export interface ServerSessionOptions extends SessionOptions {
1212
+ Http1IncomingMessage?: typeof IncomingMessage | undefined;
1213
+ Http1ServerResponse?: typeof ServerResponse | undefined;
1214
+ Http2ServerRequest?: typeof Http2ServerRequest | undefined;
1215
+ Http2ServerResponse?: typeof Http2ServerResponse | undefined;
1261
1216
  }
1262
1217
  export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {}
1263
- export interface SecureServerSessionOptions<
1264
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1265
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1266
- InstanceType<Http1Request>
1267
- >,
1268
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1269
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1270
- InstanceType<Http2Request>
1271
- >,
1272
- > extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response>, tls.TlsOptions {}
1273
- export interface ServerOptions<
1274
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1275
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1276
- InstanceType<Http1Request>
1277
- >,
1278
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1279
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1280
- InstanceType<Http2Request>
1281
- >,
1282
- > extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {}
1283
- export interface SecureServerOptions<
1284
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1285
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1286
- InstanceType<Http1Request>
1287
- >,
1288
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1289
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1290
- InstanceType<Http2Request>
1291
- >,
1292
- > extends SecureServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {
1218
+ export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions {}
1219
+ export interface ServerOptions extends ServerSessionOptions {}
1220
+ export interface SecureServerOptions extends SecureServerSessionOptions {
1293
1221
  allowHTTP1?: boolean | undefined;
1294
1222
  origins?: string[] | undefined;
1295
1223
  }
@@ -1301,28 +1229,16 @@ declare module "http2" {
1301
1229
  */
1302
1230
  updateSettings(settings: Settings): void;
1303
1231
  }
1304
- export interface Http2Server<
1305
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1306
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1307
- InstanceType<Http1Request>
1308
- >,
1309
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1310
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1311
- InstanceType<Http2Request>
1312
- >,
1313
- > extends net.Server, HTTP2ServerCommon {
1232
+ export interface Http2Server extends net.Server, HTTP2ServerCommon {
1314
1233
  addListener(
1315
1234
  event: "checkContinue",
1316
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1235
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1317
1236
  ): this;
1318
1237
  addListener(
1319
1238
  event: "request",
1320
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1321
- ): this;
1322
- addListener(
1323
- event: "session",
1324
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1239
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1325
1240
  ): this;
1241
+ addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1326
1242
  addListener(event: "sessionError", listener: (err: Error) => void): this;
1327
1243
  addListener(
1328
1244
  event: "stream",
@@ -1330,32 +1246,19 @@ declare module "http2" {
1330
1246
  ): this;
1331
1247
  addListener(event: "timeout", listener: () => void): this;
1332
1248
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1333
- emit(
1334
- event: "checkContinue",
1335
- request: InstanceType<Http2Request>,
1336
- response: InstanceType<Http2Response>,
1337
- ): boolean;
1338
- emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
1339
- emit(
1340
- event: "session",
1341
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1342
- ): boolean;
1249
+ emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
1250
+ emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
1251
+ emit(event: "session", session: ServerHttp2Session): boolean;
1343
1252
  emit(event: "sessionError", err: Error): boolean;
1344
1253
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1345
1254
  emit(event: "timeout"): boolean;
1346
1255
  emit(event: string | symbol, ...args: any[]): boolean;
1347
1256
  on(
1348
1257
  event: "checkContinue",
1349
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1350
- ): this;
1351
- on(
1352
- event: "request",
1353
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1354
- ): this;
1355
- on(
1356
- event: "session",
1357
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1258
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1358
1259
  ): this;
1260
+ on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1261
+ on(event: "session", listener: (session: ServerHttp2Session) => void): this;
1359
1262
  on(event: "sessionError", listener: (err: Error) => void): this;
1360
1263
  on(
1361
1264
  event: "stream",
@@ -1365,16 +1268,10 @@ declare module "http2" {
1365
1268
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1366
1269
  once(
1367
1270
  event: "checkContinue",
1368
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1369
- ): this;
1370
- once(
1371
- event: "request",
1372
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1373
- ): this;
1374
- once(
1375
- event: "session",
1376
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1271
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1377
1272
  ): this;
1273
+ once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1274
+ once(event: "session", listener: (session: ServerHttp2Session) => void): this;
1378
1275
  once(event: "sessionError", listener: (err: Error) => void): this;
1379
1276
  once(
1380
1277
  event: "stream",
@@ -1384,16 +1281,13 @@ declare module "http2" {
1384
1281
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1385
1282
  prependListener(
1386
1283
  event: "checkContinue",
1387
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1284
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1388
1285
  ): this;
1389
1286
  prependListener(
1390
1287
  event: "request",
1391
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1392
- ): this;
1393
- prependListener(
1394
- event: "session",
1395
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1288
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1396
1289
  ): this;
1290
+ prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1397
1291
  prependListener(event: "sessionError", listener: (err: Error) => void): this;
1398
1292
  prependListener(
1399
1293
  event: "stream",
@@ -1403,16 +1297,13 @@ declare module "http2" {
1403
1297
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1404
1298
  prependOnceListener(
1405
1299
  event: "checkContinue",
1406
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1300
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1407
1301
  ): this;
1408
1302
  prependOnceListener(
1409
1303
  event: "request",
1410
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1411
- ): this;
1412
- prependOnceListener(
1413
- event: "session",
1414
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1304
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1415
1305
  ): this;
1306
+ prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1416
1307
  prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
1417
1308
  prependOnceListener(
1418
1309
  event: "stream",
@@ -1421,28 +1312,16 @@ declare module "http2" {
1421
1312
  prependOnceListener(event: "timeout", listener: () => void): this;
1422
1313
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
1423
1314
  }
1424
- export interface Http2SecureServer<
1425
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
1426
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
1427
- InstanceType<Http1Request>
1428
- >,
1429
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
1430
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
1431
- InstanceType<Http2Request>
1432
- >,
1433
- > extends tls.Server, HTTP2ServerCommon {
1315
+ export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon {
1434
1316
  addListener(
1435
1317
  event: "checkContinue",
1436
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1318
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1437
1319
  ): this;
1438
1320
  addListener(
1439
1321
  event: "request",
1440
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1441
- ): this;
1442
- addListener(
1443
- event: "session",
1444
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1322
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1445
1323
  ): this;
1324
+ addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1446
1325
  addListener(event: "sessionError", listener: (err: Error) => void): this;
1447
1326
  addListener(
1448
1327
  event: "stream",
@@ -1451,16 +1330,9 @@ declare module "http2" {
1451
1330
  addListener(event: "timeout", listener: () => void): this;
1452
1331
  addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
1453
1332
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1454
- emit(
1455
- event: "checkContinue",
1456
- request: InstanceType<Http2Request>,
1457
- response: InstanceType<Http2Response>,
1458
- ): boolean;
1459
- emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
1460
- emit(
1461
- event: "session",
1462
- session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
1463
- ): boolean;
1333
+ emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
1334
+ emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
1335
+ emit(event: "session", session: ServerHttp2Session): boolean;
1464
1336
  emit(event: "sessionError", err: Error): boolean;
1465
1337
  emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
1466
1338
  emit(event: "timeout"): boolean;
@@ -1468,16 +1340,10 @@ declare module "http2" {
1468
1340
  emit(event: string | symbol, ...args: any[]): boolean;
1469
1341
  on(
1470
1342
  event: "checkContinue",
1471
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1472
- ): this;
1473
- on(
1474
- event: "request",
1475
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1476
- ): this;
1477
- on(
1478
- event: "session",
1479
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1343
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1480
1344
  ): this;
1345
+ on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1346
+ on(event: "session", listener: (session: ServerHttp2Session) => void): this;
1481
1347
  on(event: "sessionError", listener: (err: Error) => void): this;
1482
1348
  on(
1483
1349
  event: "stream",
@@ -1488,16 +1354,10 @@ declare module "http2" {
1488
1354
  on(event: string | symbol, listener: (...args: any[]) => void): this;
1489
1355
  once(
1490
1356
  event: "checkContinue",
1491
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1492
- ): this;
1493
- once(
1494
- event: "request",
1495
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1496
- ): this;
1497
- once(
1498
- event: "session",
1499
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1357
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1500
1358
  ): this;
1359
+ once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
1360
+ once(event: "session", listener: (session: ServerHttp2Session) => void): this;
1501
1361
  once(event: "sessionError", listener: (err: Error) => void): this;
1502
1362
  once(
1503
1363
  event: "stream",
@@ -1508,16 +1368,13 @@ declare module "http2" {
1508
1368
  once(event: string | symbol, listener: (...args: any[]) => void): this;
1509
1369
  prependListener(
1510
1370
  event: "checkContinue",
1511
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1371
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1512
1372
  ): this;
1513
1373
  prependListener(
1514
1374
  event: "request",
1515
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1516
- ): this;
1517
- prependListener(
1518
- event: "session",
1519
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1375
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1520
1376
  ): this;
1377
+ prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1521
1378
  prependListener(event: "sessionError", listener: (err: Error) => void): this;
1522
1379
  prependListener(
1523
1380
  event: "stream",
@@ -1528,16 +1385,13 @@ declare module "http2" {
1528
1385
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1529
1386
  prependOnceListener(
1530
1387
  event: "checkContinue",
1531
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1388
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1532
1389
  ): this;
1533
1390
  prependOnceListener(
1534
1391
  event: "request",
1535
- listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
1536
- ): this;
1537
- prependOnceListener(
1538
- event: "session",
1539
- listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
1392
+ listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
1540
1393
  ): this;
1394
+ prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
1541
1395
  prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
1542
1396
  prependOnceListener(
1543
1397
  event: "stream",
@@ -1568,7 +1422,7 @@ declare module "http2" {
1568
1422
  readonly aborted: boolean;
1569
1423
  /**
1570
1424
  * The request authority pseudo header field. Because HTTP/2 allows requests
1571
- * to set either `:authority` or `host`, this value is derived from `req.headers[':authority']` if present. Otherwise, it is derived from `req.headers['host']`.
1425
+ * to set either `:authority` or `host`, this value is derived from`req.headers[':authority']` if present. Otherwise, it is derived from`req.headers['host']`.
1572
1426
  * @since v8.4.0
1573
1427
  */
1574
1428
  readonly authority: string;
@@ -1615,9 +1469,9 @@ declare module "http2" {
1615
1469
  readonly headers: IncomingHttpHeaders;
1616
1470
  /**
1617
1471
  * In case of server request, the HTTP version sent by the client. In the case of
1618
- * client response, the HTTP version of the connected-to server. Returns `'2.0'`.
1472
+ * client response, the HTTP version of the connected-to server. Returns`'2.0'`.
1619
1473
  *
1620
- * Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second.
1474
+ * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second.
1621
1475
  * @since v8.4.0
1622
1476
  */
1623
1477
  readonly httpVersion: string;
@@ -1672,11 +1526,11 @@ declare module "http2" {
1672
1526
  * `destroyed`, `readable`, and `writable` properties will be retrieved from and
1673
1527
  * set on `request.stream`.
1674
1528
  *
1675
- * `destroy`, `emit`, `end`, `on` and `once` methods will be called on `request.stream`.
1529
+ * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`request.stream`.
1676
1530
  *
1677
1531
  * `setTimeout` method will be called on `request.stream.session`.
1678
1532
  *
1679
- * `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
1533
+ * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
1680
1534
  * more information.
1681
1535
  *
1682
1536
  * All other interactions will be routed directly to the socket. With TLS support,
@@ -1739,7 +1593,7 @@ declare module "http2" {
1739
1593
  * the response object.
1740
1594
  *
1741
1595
  * If no `'timeout'` listener is added to the request, the response, or
1742
- * the server, then `Http2Stream`s are destroyed when they time out. If a
1596
+ * the server, then `Http2Stream` s are destroyed when they time out. If a
1743
1597
  * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly.
1744
1598
  * @since v8.4.0
1745
1599
  */
@@ -1793,7 +1647,7 @@ declare module "http2" {
1793
1647
  * passed as the second parameter to the `'request'` event.
1794
1648
  * @since v8.4.0
1795
1649
  */
1796
- export class Http2ServerResponse<Request extends Http2ServerRequest = Http2ServerRequest> extends stream.Writable {
1650
+ export class Http2ServerResponse extends stream.Writable {
1797
1651
  constructor(stream: ServerHttp2Stream);
1798
1652
  /**
1799
1653
  * See `response.socket`.
@@ -1814,10 +1668,10 @@ declare module "http2" {
1814
1668
  */
1815
1669
  readonly headersSent: boolean;
1816
1670
  /**
1817
- * A reference to the original HTTP2 `request` object.
1671
+ * A reference to the original HTTP2 request object.
1818
1672
  * @since v15.7.0
1819
1673
  */
1820
- readonly req: Request;
1674
+ readonly req: Http2ServerRequest;
1821
1675
  /**
1822
1676
  * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but
1823
1677
  * applies getters, setters, and methods based on HTTP/2 logic.
@@ -1825,11 +1679,11 @@ declare module "http2" {
1825
1679
  * `destroyed`, `readable`, and `writable` properties will be retrieved from and
1826
1680
  * set on `response.stream`.
1827
1681
  *
1828
- * `destroy`, `emit`, `end`, `on` and `once` methods will be called on `response.stream`.
1682
+ * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`response.stream`.
1829
1683
  *
1830
1684
  * `setTimeout` method will be called on `response.stream.session`.
1831
1685
  *
1832
- * `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
1686
+ * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
1833
1687
  * more information.
1834
1688
  *
1835
1689
  * All other interactions will be routed directly to the socket.
@@ -1933,7 +1787,7 @@ declare module "http2" {
1933
1787
  * header names and the values are the respective header values. All header names
1934
1788
  * are lowercase.
1935
1789
  *
1936
- * 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()`,
1790
+ * 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()`,
1937
1791
  * `obj.hasOwnProperty()`, and others
1938
1792
  * are not defined and _will not work_.
1939
1793
  *
@@ -2007,7 +1861,7 @@ declare module "http2" {
2007
1861
  *
2008
1862
  * If no `'timeout'` listener is added to the request, the response, or
2009
1863
  * the server, then `Http2Stream` s are destroyed when they time out. If a
2010
- * handler is assigned to the request, the response, or the server's `'timeout'` events, timed out sockets must be handled explicitly.
1864
+ * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly.
2011
1865
  * @since v8.4.0
2012
1866
  */
2013
1867
  setTimeout(msecs: number, callback?: () => void): void;
@@ -2018,8 +1872,8 @@ declare module "http2" {
2018
1872
  * This sends a chunk of the response body. This method may
2019
1873
  * be called multiple times to provide successive parts of the body.
2020
1874
  *
2021
- * In the `node:http` module, the response body is omitted when the
2022
- * request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body.
1875
+ * In the `http` module, the response body is omitted when the
1876
+ * request is a HEAD request. Similarly, the `204` and `304` responses_must not_ include a message body.
2023
1877
  *
2024
1878
  * `chunk` can be a string or a buffer. If `chunk` is a string,
2025
1879
  * the second parameter specifies how to encode it into a byte stream.
@@ -2069,7 +1923,7 @@ declare module "http2" {
2069
1923
  * `Content-Length` is given in bytes not characters. The`Buffer.byteLength()` API may be used to determine the number of bytes in a
2070
1924
  * given encoding. On outbound messages, Node.js does not check if Content-Length
2071
1925
  * and the length of the body being transmitted are equal or not. However, when
2072
- * receiving messages, Node.js will automatically reject messages when the `Content-Length` does not match the actual payload size.
1926
+ * receiving messages, Node.js will automatically reject messages when the`Content-Length` does not match the actual payload size.
2073
1927
  *
2074
1928
  * This method may be called at most one time on a message before `response.end()` is called.
2075
1929
  *
@@ -2375,7 +2229,7 @@ declare module "http2" {
2375
2229
  */
2376
2230
  export const sensitiveHeaders: symbol;
2377
2231
  /**
2378
- * Returns an object containing the default settings for an `Http2Session` instance. This method returns a new object instance every time it is called
2232
+ * Returns an object containing the default settings for an `Http2Session`instance. This method returns a new object instance every time it is called
2379
2233
  * so instances returned may be safely modified for use.
2380
2234
  * @since v8.4.0
2381
2235
  */
@@ -2404,7 +2258,7 @@ declare module "http2" {
2404
2258
  */
2405
2259
  export function getUnpackedSettings(buf: Uint8Array): Settings;
2406
2260
  /**
2407
- * Returns a `net.Server` instance that creates and manages `Http2Session` instances.
2261
+ * Returns a `net.Server` instance that creates and manages `Http2Session`instances.
2408
2262
  *
2409
2263
  * 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
2410
2264
  * communicating
@@ -2422,12 +2276,12 @@ declare module "http2" {
2422
2276
  * server.on('stream', (stream, headers) => {
2423
2277
  * stream.respond({
2424
2278
  * 'content-type': 'text/html; charset=utf-8',
2425
- * ':status': 200,
2279
+ * ':status': 200
2426
2280
  * });
2427
2281
  * stream.end('<h1>Hello World</h1>');
2428
2282
  * });
2429
2283
  *
2430
- * server.listen(8000);
2284
+ * server.listen(80);
2431
2285
  * ```
2432
2286
  * @since v8.4.0
2433
2287
  * @param onRequestHandler See `Compatibility API`
@@ -2435,21 +2289,12 @@ declare module "http2" {
2435
2289
  export function createServer(
2436
2290
  onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2437
2291
  ): Http2Server;
2438
- export function createServer<
2439
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
2440
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
2441
- InstanceType<Http1Request>
2442
- >,
2443
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
2444
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
2445
- InstanceType<Http2Request>
2446
- >,
2447
- >(
2448
- options: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
2449
- onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
2450
- ): Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>;
2292
+ export function createServer(
2293
+ options: ServerOptions,
2294
+ onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2295
+ ): Http2Server;
2451
2296
  /**
2452
- * Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
2297
+ * Returns a `tls.Server` instance that creates and manages `Http2Session`instances.
2453
2298
  *
2454
2299
  * ```js
2455
2300
  * const http2 = require('http2');
@@ -2457,7 +2302,7 @@ declare module "http2" {
2457
2302
  *
2458
2303
  * const options = {
2459
2304
  * key: fs.readFileSync('server-key.pem'),
2460
- * cert: fs.readFileSync('server-cert.pem'),
2305
+ * cert: fs.readFileSync('server-cert.pem')
2461
2306
  * };
2462
2307
  *
2463
2308
  * // Create a secure HTTP/2 server
@@ -2466,12 +2311,12 @@ declare module "http2" {
2466
2311
  * server.on('stream', (stream, headers) => {
2467
2312
  * stream.respond({
2468
2313
  * 'content-type': 'text/html; charset=utf-8',
2469
- * ':status': 200,
2314
+ * ':status': 200
2470
2315
  * });
2471
2316
  * stream.end('<h1>Hello World</h1>');
2472
2317
  * });
2473
2318
  *
2474
- * server.listen(8443);
2319
+ * server.listen(80);
2475
2320
  * ```
2476
2321
  * @since v8.4.0
2477
2322
  * @param onRequestHandler See `Compatibility API`
@@ -2479,19 +2324,10 @@ declare module "http2" {
2479
2324
  export function createSecureServer(
2480
2325
  onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2481
2326
  ): Http2SecureServer;
2482
- export function createSecureServer<
2483
- Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
2484
- Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse<
2485
- InstanceType<Http1Request>
2486
- >,
2487
- Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
2488
- Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse<
2489
- InstanceType<Http2Request>
2490
- >,
2491
- >(
2492
- options: SecureServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
2493
- onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
2494
- ): Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>;
2327
+ export function createSecureServer(
2328
+ options: SecureServerOptions,
2329
+ onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
2330
+ ): Http2SecureServer;
2495
2331
  /**
2496
2332
  * Returns a `ClientHttp2Session` instance.
2497
2333
  *
node v16.18/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(
@@ -115,19 +109,19 @@ declare module "https" {
115
109
  emit(
116
110
  event: "checkContinue",
117
111
  req: InstanceType<Request>,
118
- res: InstanceType<Response>,
112
+ res: InstanceType<Response> & { req: InstanceType<Request> },
119
113
  ): boolean;
120
114
  emit(
121
115
  event: "checkExpectation",
122
116
  req: InstanceType<Request>,
123
- res: InstanceType<Response>,
117
+ res: InstanceType<Response> & { req: InstanceType<Request> },
124
118
  ): boolean;
125
119
  emit(event: "clientError", err: Error, socket: Duplex): boolean;
126
120
  emit(event: "connect", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
127
121
  emit(
128
122
  event: "request",
129
123
  req: InstanceType<Request>,
130
- res: InstanceType<Response>,
124
+ res: InstanceType<Response> & { req: InstanceType<Request> },
131
125
  ): boolean;
132
126
  emit(event: "upgrade", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
133
127
  on(event: string, listener: (...args: any[]) => void): this;
@@ -302,15 +296,11 @@ declare module "https" {
302
296
  */
303
297
  function createServer<
304
298
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
305
- Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse<
306
- InstanceType<Request>
307
- >,
299
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
308
300
  >(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
309
301
  function createServer<
310
302
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
311
- Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse<
312
- InstanceType<Request>
313
- >,
303
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
314
304
  >(
315
305
  options: ServerOptions<Request, Response>,
316
306
  requestListener?: http.RequestListener<Request, Response>,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "16.18.107",
3
+ "version": "16.18.108",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -210,6 +210,6 @@
210
210
  },
211
211
  "scripts": {},
212
212
  "dependencies": {},
213
- "typesPublisherContentHash": "2e43ad1a49e4e03c340b7cddb756224a8aa3814562090f931c92dd3647a13e23",
213
+ "typesPublisherContentHash": "eefbc030a82672d0a58c0ef369e7bc503e92d6ff5124e24b8b49696e86460e6a",
214
214
  "typeScriptVersion": "4.8"
215
215
  }