@types/node 16.4.11 → 16.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/dgram.d.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  * The `dgram` module provides an implementation of UDP datagram sockets.
3
3
  *
4
4
  * ```js
5
- * const dgram = require('dgram');
5
+ * import dgram from 'dgram';
6
+ *
6
7
  * const server = dgram.createSocket('udp4');
7
8
  *
8
9
  * server.on('error', (err) => {
@@ -22,7 +23,7 @@
22
23
  * server.bind(41234);
23
24
  * // Prints: server listening 0.0.0.0:41234
24
25
  * ```
25
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/dgram.js)
26
+ * @see [source](https://github.com/nodejs/node/blob/v16.6.0/lib/dgram.js)
26
27
  */
27
28
  declare module 'dgram' {
28
29
  import { AddressInfo } from 'node:net';
@@ -97,8 +98,9 @@ declare module 'dgram' {
97
98
  * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
98
99
  *
99
100
  * ```js
100
- * const cluster = require('cluster');
101
- * const dgram = require('dgram');
101
+ * import cluster from 'cluster';
102
+ * import dgram from 'dgram';
103
+ *
102
104
  * if (cluster.isPrimary) {
103
105
  * cluster.fork(); // Works ok.
104
106
  * cluster.fork(); // Fails with EADDRINUSE.
@@ -140,7 +142,8 @@ declare module 'dgram' {
140
142
  * Example of a UDP server listening on port 41234:
141
143
  *
142
144
  * ```js
143
- * const dgram = require('dgram');
145
+ * import dgram from 'dgram';
146
+ *
144
147
  * const server = dgram.createSocket('udp4');
145
148
  *
146
149
  * server.on('error', (err) => {
@@ -281,7 +284,9 @@ declare module 'dgram' {
281
284
  * Example of sending a UDP packet to a port on `localhost`;
282
285
  *
283
286
  * ```js
284
- * const dgram = require('dgram');
287
+ * import dgram from 'dgram';
288
+ * import { Buffer } from 'buffer';
289
+ *
285
290
  * const message = Buffer.from('Some bytes');
286
291
  * const client = dgram.createSocket('udp4');
287
292
  * client.send(message, 41234, 'localhost', (err) => {
@@ -292,7 +297,9 @@ declare module 'dgram' {
292
297
  * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
293
298
  *
294
299
  * ```js
295
- * const dgram = require('dgram');
300
+ * import dgram from 'dgram';
301
+ * import { Buffer } from 'buffer';
302
+ *
296
303
  * const buf1 = Buffer.from('Some ');
297
304
  * const buf2 = Buffer.from('bytes');
298
305
  * const client = dgram.createSocket('udp4');
@@ -309,7 +316,9 @@ declare module 'dgram' {
309
316
  * Example of sending a UDP packet using a socket connected to a port on`localhost`:
310
317
  *
311
318
  * ```js
312
- * const dgram = require('dgram');
319
+ * import dgram from 'dgram';
320
+ * import { Buffer } from 'buffer';
321
+ *
313
322
  * const message = Buffer.from('Some bytes');
314
323
  * const client = dgram.createSocket('udp4');
315
324
  * client.connect(41234, 'localhost', (err) => {
@@ -5,7 +5,7 @@
5
5
  * It can be accessed using:
6
6
  *
7
7
  * ```js
8
- * const diagnostics_channel = require('diagnostics_channel');
8
+ * import diagnostics_channel from 'diagnostics_channel';
9
9
  * ```
10
10
  *
11
11
  * It is intended that a module writer wanting to report diagnostics messages
@@ -20,7 +20,7 @@
20
20
  * should generally include the module name to avoid collisions with data from
21
21
  * other modules.
22
22
  * @experimental
23
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/diagnostics_channel.js)
23
+ * @see [source](https://github.com/nodejs/node/blob/v16.6.0/lib/diagnostics_channel.js)
24
24
  */
25
25
  declare module 'diagnostics_channel' {
26
26
  /**
@@ -31,7 +31,7 @@ declare module 'diagnostics_channel' {
31
31
  * performance-sensitive code.
32
32
  *
33
33
  * ```js
34
- * const diagnostics_channel = require('diagnostics_channel');
34
+ * import diagnostics_channel from 'diagnostics_channel';
35
35
  *
36
36
  * if (diagnostics_channel.hasSubscribers('my-channel')) {
37
37
  * // There are subscribers, prepare and publish message
@@ -47,7 +47,7 @@ declare module 'diagnostics_channel' {
47
47
  * publish time as much as possible.
48
48
  *
49
49
  * ```js
50
- * const diagnostics_channel = require('diagnostics_channel');
50
+ * import diagnostics_channel from 'diagnostics_channel';
51
51
  *
52
52
  * const channel = diagnostics_channel.channel('my-channel');
53
53
  * ```
@@ -66,7 +66,24 @@ declare module 'diagnostics_channel' {
66
66
  */
67
67
  class Channel {
68
68
  readonly name: string;
69
- readonly hashSubscribers: boolean;
69
+ /**
70
+ * Check if there are active subscribers to this channel. This is helpful if
71
+ * the message you want to send might be expensive to prepare.
72
+ *
73
+ * This API is optional but helpful when trying to publish messages from very
74
+ * performance-sensitive code.
75
+ *
76
+ * ```js
77
+ * import diagnostics_channel from 'diagnostics_channel';
78
+ *
79
+ * const channel = diagnostics_channel.channel('my-channel');
80
+ *
81
+ * if (channel.hasSubscribers) {
82
+ * // There are subscribers, prepare and publish message
83
+ * }
84
+ * ```
85
+ */
86
+ readonly hasSubscribers: boolean;
70
87
  private constructor(name: string);
71
88
  /**
72
89
  * Register a message handler to subscribe to this channel. This message handler
@@ -74,7 +91,7 @@ declare module 'diagnostics_channel' {
74
91
  * errors thrown in the message handler will trigger an `'uncaughtException'`.
75
92
  *
76
93
  * ```js
77
- * const diagnostics_channel = require('diagnostics_channel');
94
+ * import diagnostics_channel from 'diagnostics_channel';
78
95
  *
79
96
  * const channel = diagnostics_channel.channel('my-channel');
80
97
  *
@@ -89,7 +106,7 @@ declare module 'diagnostics_channel' {
89
106
  * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
90
107
  *
91
108
  * ```js
92
- * const diagnostics_channel = require('diagnostics_channel');
109
+ * import diagnostics_channel from 'diagnostics_channel';
93
110
  *
94
111
  * const channel = diagnostics_channel.channel('my-channel');
95
112
  *
node/dns.d.ts CHANGED
@@ -42,7 +42,7 @@
42
42
  * ```
43
43
  *
44
44
  * See the `Implementation considerations section` for more information.
45
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/dns.js)
45
+ * @see [source](https://github.com/nodejs/node/blob/v16.6.0/lib/dns.js)
46
46
  */
47
47
  declare module 'dns' {
48
48
  import * as dnsPromises from 'node:dns/promises';
node/domain.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * **This module is pending deprecation**. Once a replacement API has been
2
+ * **This module is pending deprecation.** Once a replacement API has been
3
3
  * finalized, this module will be fully deprecated. Most developers should**not** have cause to use this module. Users who absolutely must have
4
4
  * the functionality that domains provide may rely on it for the time being
5
5
  * but should expect to have to migrate to a different solution
@@ -11,7 +11,7 @@
11
11
  * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
12
12
  * exit immediately with an error code.
13
13
  * @deprecated Since v1.4.2 - Deprecated
14
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/domain.js)
14
+ * @see [source](https://github.com/nodejs/node/blob/v16.6.0/lib/domain.js)
15
15
  */
16
16
  declare module 'domain' {
17
17
  import EventEmitter = require('node:events');
node/events.d.ts CHANGED
@@ -32,7 +32,7 @@
32
32
  * });
33
33
  * myEmitter.emit('event');
34
34
  * ```
35
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/events.js)
35
+ * @see [source](https://github.com/nodejs/node/blob/v16.6.0/lib/events.js)
36
36
  */
37
37
  declare module 'events' {
38
38
  interface EventEmitterOptions {
node/fs/promises.d.ts CHANGED
@@ -29,7 +29,12 @@ declare module 'fs/promises' {
29
29
  OpenMode,
30
30
  Mode,
31
31
  WatchOptions,
32
+ WatchEventType,
32
33
  } from 'node:fs';
34
+ interface FileChangeInfo<T extends (string | Buffer)> {
35
+ eventType: WatchEventType;
36
+ filename: T;
37
+ }
33
38
  interface FlagAndOpenMode {
34
39
  mode?: Mode | undefined;
35
40
  flag?: OpenMode | undefined;
@@ -233,6 +238,8 @@ declare module 'fs/promises' {
233
238
  /**
234
239
  * Write `buffer` to the file.
235
240
  *
241
+ * If `buffer` is a plain object, it must have an own (not inherited) `toString`function property.
242
+ *
236
243
  * The promise is resolved with an object containing two properties:
237
244
  *
238
245
  * It is unsafe to use `filehandle.write()` multiple times on the same file
@@ -732,8 +739,7 @@ declare module 'fs/promises' {
732
739
  */
733
740
  function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
734
741
  /**
735
- * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a `<Buffer>`, or an object with an own `toString` function
736
- * property.
742
+ * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a `<Buffer>`, or, an object with an own (not inherited)`toString` function property.
737
743
  *
738
744
  * The `encoding` option is ignored if `data` is a buffer.
739
745
  *
@@ -754,6 +760,7 @@ declare module 'fs/promises' {
754
760
  *
755
761
  * ```js
756
762
  * import { writeFile } from 'fs/promises';
763
+ * import { Buffer } from 'buffer';
757
764
  *
758
765
  * try {
759
766
  * const controller = new AbortController();
@@ -951,7 +958,7 @@ declare module 'fs/promises' {
951
958
  encoding: 'buffer';
952
959
  })
953
960
  | 'buffer'
954
- ): AsyncIterable<Buffer>;
961
+ ): AsyncIterable<FileChangeInfo<Buffer>>;
955
962
  /**
956
963
  * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
957
964
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
@@ -960,7 +967,7 @@ declare module 'fs/promises' {
960
967
  * If `persistent` is not supplied, the default of `true` is used.
961
968
  * If `recursive` is not supplied, the default of `false` is used.
962
969
  */
963
- function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable<string>;
970
+ function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable<FileChangeInfo<string>>;
964
971
  /**
965
972
  * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
966
973
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
@@ -969,7 +976,7 @@ declare module 'fs/promises' {
969
976
  * If `persistent` is not supplied, the default of `true` is used.
970
977
  * If `recursive` is not supplied, the default of `false` is used.
971
978
  */
972
- function watch(filename: PathLike, options: WatchOptions | string): AsyncIterable<string> | AsyncIterable<Buffer>;
979
+ function watch(filename: PathLike, options: WatchOptions | string): AsyncIterable<FileChangeInfo<string>> | AsyncIterable<FileChangeInfo<Buffer>>;
973
980
  }
974
981
  declare module 'node:fs/promises' {
975
982
  export * from 'fs/promises';
node/fs.d.ts CHANGED
@@ -5,30 +5,18 @@
5
5
  * To use the promise-based APIs:
6
6
  *
7
7
  * ```js
8
- * // Using ESM Module syntax:
9
8
  * import * as fs from 'fs/promises';
10
9
  * ```
11
10
  *
12
- * ```js
13
- * // Using CommonJS syntax:
14
- * const fs = require('fs/promises');
15
- * ```
16
- *
17
11
  * To use the callback and sync APIs:
18
12
  *
19
13
  * ```js
20
- * // Using ESM Module syntax:
21
14
  * import * as fs from 'fs';
22
15
  * ```
23
16
  *
24
- * ```js
25
- * // Using CommonJS syntax:
26
- * const fs = require('fs');
27
- * ```
28
- *
29
17
  * All file system operations have synchronous, callback, and promise-based
30
18
  * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
31
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/fs.js)
19
+ * @see [source](https://github.com/nodejs/node/blob/v16.6.0/lib/fs.js)
32
20
  */
33
21
  declare module 'fs' {
34
22
  import * as stream from 'node:stream';
@@ -2177,6 +2165,8 @@ declare module 'fs' {
2177
2165
  }>;
2178
2166
  }
2179
2167
  /**
2168
+ * If `buffer` is a plain object, it must have an own (not inherited) `toString`function property.
2169
+ *
2180
2170
  * For detailed information, see the documentation of the asynchronous version of
2181
2171
  * this API: {@link write}.
2182
2172
  * @since v0.1.21
@@ -2510,10 +2500,12 @@ declare module 'fs' {
2510
2500
  * a file descriptor.
2511
2501
  *
2512
2502
  * The `encoding` option is ignored if `data` is a buffer.
2513
- * If `data` is a normal object, it must have an own `toString` function property.
2503
+ *
2504
+ * If `data` is a plain object, it must have an own (not inherited) `toString`function property.
2514
2505
  *
2515
2506
  * ```js
2516
2507
  * import { writeFile } from 'fs';
2508
+ * import { Buffer } from 'buffer';
2517
2509
  *
2518
2510
  * const data = new Uint8Array(Buffer.from('Hello Node.js'));
2519
2511
  * writeFile('message.txt', data, (err) => {
@@ -2544,6 +2536,7 @@ declare module 'fs' {
2544
2536
  *
2545
2537
  * ```js
2546
2538
  * import { writeFile } from 'fs';
2539
+ * import { Buffer } from 'buffer';
2547
2540
  *
2548
2541
  * const controller = new AbortController();
2549
2542
  * const { signal } = controller;
@@ -2586,6 +2579,8 @@ declare module 'fs' {
2586
2579
  /**
2587
2580
  * Returns `undefined`.
2588
2581
  *
2582
+ * If `data` is a plain object, it must have an own (not inherited) `toString`function property.
2583
+ *
2589
2584
  * For detailed information, see the documentation of the asynchronous version of
2590
2585
  * this API: {@link writeFile}.
2591
2586
  * @since v0.1.29
@@ -2791,7 +2786,8 @@ declare module 'fs' {
2791
2786
  persistent?: boolean | undefined;
2792
2787
  recursive?: boolean | undefined;
2793
2788
  }
2794
- export type WatchListener<T> = (event: 'rename' | 'change', filename: T) => void;
2789
+ export type WatchEventType = 'rename' | 'change';
2790
+ export type WatchListener<T> = (event: WatchEventType, filename: T) => void;
2795
2791
  /**
2796
2792
  * Watch for changes on `filename`, where `filename` is either a file or a
2797
2793
  * directory.
@@ -3145,7 +3141,7 @@ declare module 'fs' {
3145
3141
  * });
3146
3142
  *
3147
3143
  * // Check if the file exists in the current directory, and if it is writable.
3148
- * access(file, constants.F_OK | fs.constants.W_OK, (err) => {
3144
+ * access(file, constants.F_OK | constants.W_OK, (err) => {
3149
3145
  * if (err) {
3150
3146
  * console.error(
3151
3147
  * `${file} ${err.code === 'ENOENT' ? 'does not exist' : 'is read-only'}`);
node/globals.d.ts CHANGED
@@ -13,19 +13,6 @@ interface ErrorConstructor {
13
13
  stackTraceLimit: number;
14
14
  }
15
15
 
16
- // Node.js ESNEXT support
17
- interface String {
18
- /** Removes whitespace from the left end of a string. */
19
- trimLeft(): string;
20
- /** Removes whitespace from the right end of a string. */
21
- trimRight(): string;
22
-
23
- /** Returns a copy with leading whitespace removed. */
24
- trimStart(): string;
25
- /** Returns a copy with trailing whitespace removed. */
26
- trimEnd(): string;
27
- }
28
-
29
16
  /*-----------------------------------------------*
30
17
  * *
31
18
  * GLOBAL *
@@ -89,6 +76,30 @@ declare var AbortSignal: {
89
76
  };
90
77
  //#endregion borrowed
91
78
 
79
+ //#region ArrayLike.at()
80
+ interface RelativeIndexable<T> {
81
+ /**
82
+ * Takes an integer value and returns the item at that index,
83
+ * allowing for positive and negative integers.
84
+ * Negative integers count back from the last item in the array.
85
+ */
86
+ at(index: number): T | undefined;
87
+ }
88
+ interface String extends RelativeIndexable<string> {}
89
+ interface Array<T> extends RelativeIndexable<T> {}
90
+ interface Int8Array extends RelativeIndexable<number> {}
91
+ interface Uint8Array extends RelativeIndexable<number> {}
92
+ interface Uint8ClampedArray extends RelativeIndexable<number> {}
93
+ interface Int16Array extends RelativeIndexable<number> {}
94
+ interface Uint16Array extends RelativeIndexable<number> {}
95
+ interface Int32Array extends RelativeIndexable<number> {}
96
+ interface Uint32Array extends RelativeIndexable<number> {}
97
+ interface Float32Array extends RelativeIndexable<number> {}
98
+ interface Float64Array extends RelativeIndexable<number> {}
99
+ interface BigInt64Array extends RelativeIndexable<bigint> {}
100
+ interface BigUint64Array extends RelativeIndexable<bigint> {}
101
+ //#endregion ArrayLike.at() end
102
+
92
103
  /*----------------------------------------------*
93
104
  * *
94
105
  * GLOBAL INTERFACES *
node/http.d.ts CHANGED
@@ -37,7 +37,7 @@
37
37
  * 'Host', 'mysite.com',
38
38
  * 'accepT', '*' ]
39
39
  * ```
40
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/http.js)
40
+ * @see [source](https://github.com/nodejs/node/blob/v16.6.0/lib/http.js)
41
41
  */
42
42
  declare module 'http' {
43
43
  import * as stream from 'node:stream';
@@ -156,37 +156,154 @@ declare module 'http' {
156
156
  insecureHTTPParser?: boolean | undefined;
157
157
  }
158
158
  type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
159
- interface HttpBase {
159
+ /**
160
+ * @since v0.1.17
161
+ */
162
+ class Server extends NetServer {
163
+ constructor(requestListener?: RequestListener);
164
+ constructor(options: ServerOptions, requestListener?: RequestListener);
165
+ /**
166
+ * Sets the timeout value for sockets, and emits a `'timeout'` event on
167
+ * the Server object, passing the socket as an argument, if a timeout
168
+ * occurs.
169
+ *
170
+ * If there is a `'timeout'` event listener on the Server object, then it
171
+ * will be called with the timed-out socket as an argument.
172
+ *
173
+ * By default, the Server does not timeout sockets. However, if a callback
174
+ * is assigned to the Server's `'timeout'` event, timeouts must be handled
175
+ * explicitly.
176
+ * @since v0.9.12
177
+ * @param [msecs=0 (no timeout)]
178
+ */
160
179
  setTimeout(msecs?: number, callback?: () => void): this;
161
180
  setTimeout(callback: () => void): this;
162
181
  /**
163
182
  * Limits maximum incoming headers count. If set to 0, no limit will be applied.
164
- * @default 2000
165
- * {@link https://nodejs.org/api/http.html#http_server_maxheaderscount}
183
+ * @since v0.7.0
166
184
  */
167
185
  maxHeadersCount: number | null;
186
+ /**
187
+ * The number of milliseconds of inactivity before a socket is presumed
188
+ * to have timed out.
189
+ *
190
+ * A value of `0` will disable the timeout behavior on incoming connections.
191
+ *
192
+ * The socket timeout logic is set up on connection, so changing this
193
+ * value only affects new connections to the server, not any existing connections.
194
+ * @since v0.9.12
195
+ */
168
196
  timeout: number;
169
197
  /**
170
- * Limit the amount of time the parser will wait to receive the complete HTTP headers.
171
- * @default 60000
172
- * {@link https://nodejs.org/api/http.html#http_server_headerstimeout}
198
+ * Limit the amount of time the parser will wait to receive the complete HTTP
199
+ * headers.
200
+ *
201
+ * In case of inactivity, the rules defined in `server.timeout` apply. However,
202
+ * that inactivity based timeout would still allow the connection to be kept open
203
+ * if the headers are being sent very slowly (by default, up to a byte per 2
204
+ * minutes). In order to prevent this, whenever header data arrives an additional
205
+ * check is made that more than `server.headersTimeout` milliseconds has not
206
+ * passed since the connection was established. If the check fails, a `'timeout'`event is emitted on the server object, and (by default) the socket is destroyed.
207
+ * See `server.timeout` for more information on how timeout behavior can be
208
+ * customized.
209
+ * @since v11.3.0, v10.14.0
173
210
  */
174
211
  headersTimeout: number;
212
+ /**
213
+ * The number of milliseconds of inactivity a server needs to wait for additional
214
+ * incoming data, after it has finished writing the last response, before a socket
215
+ * will be destroyed. If the server receives new data before the keep-alive
216
+ * timeout has fired, it will reset the regular inactivity timeout, i.e.,`server.timeout`.
217
+ *
218
+ * A value of `0` will disable the keep-alive timeout behavior on incoming
219
+ * connections.
220
+ * A value of `0` makes the http server behave similarly to Node.js versions prior
221
+ * to 8.0.0, which did not have a keep-alive timeout.
222
+ *
223
+ * The socket timeout logic is set up on connection, so changing this value only
224
+ * affects new connections to the server, not any existing connections.
225
+ * @since v8.0.0
226
+ */
175
227
  keepAliveTimeout: number;
176
228
  /**
177
- * Sets the timeout value in milliseconds for receiving the entire request from the client.
178
- * @default 0
179
- * {@link https://nodejs.org/api/http.html#http_server_requesttimeout}
229
+ * Sets the timeout value in milliseconds for receiving the entire request from
230
+ * the client.
231
+ *
232
+ * If the timeout expires, the server responds with status 408 without
233
+ * forwarding the request to the request listener and then closes the connection.
234
+ *
235
+ * It must be set to a non-zero value (e.g. 120 seconds) to protect against
236
+ * potential Denial-of-Service attacks in case the server is deployed without a
237
+ * reverse proxy in front.
238
+ * @since v14.11.0
180
239
  */
181
240
  requestTimeout: number;
182
- }
183
- interface Server extends HttpBase {}
184
- /**
185
- * @since v0.1.17
186
- */
187
- class Server extends NetServer {
188
- constructor(requestListener?: RequestListener);
189
- constructor(options: ServerOptions, requestListener?: RequestListener);
241
+ addListener(event: string, listener: (...args: any[]) => void): this;
242
+ addListener(event: 'close', listener: () => void): this;
243
+ addListener(event: 'connection', listener: (socket: Socket) => void): this;
244
+ addListener(event: 'error', listener: (err: Error) => void): this;
245
+ addListener(event: 'listening', listener: () => void): this;
246
+ addListener(event: 'checkContinue', listener: RequestListener): this;
247
+ addListener(event: 'checkExpectation', listener: RequestListener): this;
248
+ addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
249
+ addListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
250
+ addListener(event: 'request', listener: RequestListener): this;
251
+ addListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
252
+ emit(event: string, ...args: any[]): boolean;
253
+ emit(event: 'close'): boolean;
254
+ emit(event: 'connection', socket: Socket): boolean;
255
+ emit(event: 'error', err: Error): boolean;
256
+ emit(event: 'listening'): boolean;
257
+ emit(event: 'checkContinue', req: IncomingMessage, res: ServerResponse): boolean;
258
+ emit(event: 'checkExpectation', req: IncomingMessage, res: ServerResponse): boolean;
259
+ emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean;
260
+ emit(event: 'connect', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
261
+ emit(event: 'request', req: IncomingMessage, res: ServerResponse): boolean;
262
+ emit(event: 'upgrade', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
263
+ on(event: string, listener: (...args: any[]) => void): this;
264
+ on(event: 'close', listener: () => void): this;
265
+ on(event: 'connection', listener: (socket: Socket) => void): this;
266
+ on(event: 'error', listener: (err: Error) => void): this;
267
+ on(event: 'listening', listener: () => void): this;
268
+ on(event: 'checkContinue', listener: RequestListener): this;
269
+ on(event: 'checkExpectation', listener: RequestListener): this;
270
+ on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
271
+ on(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
272
+ on(event: 'request', listener: RequestListener): this;
273
+ on(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
274
+ once(event: string, listener: (...args: any[]) => void): this;
275
+ once(event: 'close', listener: () => void): this;
276
+ once(event: 'connection', listener: (socket: Socket) => void): this;
277
+ once(event: 'error', listener: (err: Error) => void): this;
278
+ once(event: 'listening', listener: () => void): this;
279
+ once(event: 'checkContinue', listener: RequestListener): this;
280
+ once(event: 'checkExpectation', listener: RequestListener): this;
281
+ once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
282
+ once(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
283
+ once(event: 'request', listener: RequestListener): this;
284
+ once(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
285
+ prependListener(event: string, listener: (...args: any[]) => void): this;
286
+ prependListener(event: 'close', listener: () => void): this;
287
+ prependListener(event: 'connection', listener: (socket: Socket) => void): this;
288
+ prependListener(event: 'error', listener: (err: Error) => void): this;
289
+ prependListener(event: 'listening', listener: () => void): this;
290
+ prependListener(event: 'checkContinue', listener: RequestListener): this;
291
+ prependListener(event: 'checkExpectation', listener: RequestListener): this;
292
+ prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
293
+ prependListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
294
+ prependListener(event: 'request', listener: RequestListener): this;
295
+ prependListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
296
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
297
+ prependOnceListener(event: 'close', listener: () => void): this;
298
+ prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
299
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
300
+ prependOnceListener(event: 'listening', listener: () => void): this;
301
+ prependOnceListener(event: 'checkContinue', listener: RequestListener): this;
302
+ prependOnceListener(event: 'checkExpectation', listener: RequestListener): this;
303
+ prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
304
+ prependOnceListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
305
+ prependOnceListener(event: 'request', listener: RequestListener): this;
306
+ prependOnceListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
190
307
  }
191
308
  /**
192
309
  * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract of outgoing message from
node/http2.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * const http2 = require('http2');
7
7
  * ```
8
8
  * @since v8.4.0
9
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/http2.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v16.6.0/lib/http2.js)
10
10
  */
11
11
  declare module 'http2' {
12
12
  import EventEmitter = require('node:events');