@types/node 16.11.39 → 18.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. {node v16.11 → node}/LICENSE +0 -0
  2. node v16.11/README.md → node/README.md +4 -4
  3. {node v16.11 → node}/assert/strict.d.ts +0 -0
  4. node v16.11/assert.d.ts → node/assert.d.ts +7 -8
  5. node v16.11/async_hooks.d.ts → node/async_hooks.d.ts +8 -4
  6. node/buffer.d.ts +2258 -0
  7. node v16.11/child_process.d.ts → node/child_process.d.ts +6 -3
  8. node v16.11/cluster.d.ts → node/cluster.d.ts +14 -18
  9. node v16.11/console.d.ts → node/console.d.ts +1 -1
  10. {node v16.11 → node}/constants.d.ts +0 -0
  11. node v16.11/crypto.d.ts → node/crypto.d.ts +679 -53
  12. node v16.11/dgram.d.ts → node/dgram.d.ts +3 -3
  13. node v16.11/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +2 -1
  14. node v16.11/dns/promises.d.ts → node/dns/promises.d.ts +10 -8
  15. node v16.11/dns.d.ts → node/dns.d.ts +16 -11
  16. node/dom-events.d.ts +126 -0
  17. node v16.11/domain.d.ts → node/domain.d.ts +3 -2
  18. node v16.11/events.d.ts → node/events.d.ts +65 -10
  19. node v16.11/fs/promises.d.ts → node/fs/promises.d.ts +86 -39
  20. node v16.11/fs.d.ts → node/fs.d.ts +149 -67
  21. node/globals.d.ts +300 -0
  22. {node v16.11 → node}/globals.global.d.ts +0 -0
  23. node v16.11/http.d.ts → node/http.d.ts +305 -77
  24. node v16.11/http2.d.ts → node/http2.d.ts +38 -5
  25. node v16.11/https.d.ts → node/https.d.ts +209 -59
  26. node v16.11/index.d.ts → node/index.d.ts +6 -3
  27. node v16.11/inspector.d.ts → node/inspector.d.ts +11 -15
  28. {node v16.11 → node}/module.d.ts +0 -0
  29. node v16.11/net.d.ts → node/net.d.ts +94 -21
  30. node v16.11/os.d.ts → node/os.d.ts +15 -4
  31. node v16.11/package.json → node/package.json +15 -8
  32. node v16.11/path.d.ts → node/path.d.ts +34 -23
  33. node v16.11/perf_hooks.d.ts → node/perf_hooks.d.ts +76 -8
  34. node v16.11/process.d.ts → node/process.d.ts +17 -16
  35. node v16.11/punycode.d.ts → node/punycode.d.ts +1 -1
  36. node v16.11/querystring.d.ts → node/querystring.d.ts +4 -4
  37. node/readline/promises.d.ts +143 -0
  38. node v16.11/readline.d.ts → node/readline.d.ts +140 -30
  39. node v16.11/repl.d.ts → node/repl.d.ts +2 -2
  40. node v16.11/stream/consumers.d.ts → node/stream/consumers.d.ts +2 -14
  41. {node v16.11 → node}/stream/promises.d.ts +0 -0
  42. node v16.11/stream/web.d.ts → node/stream/web.d.ts +3 -65
  43. node v16.11/stream.d.ts → node/stream.d.ts +97 -19
  44. node v16.11/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
  45. node/test.d.ts +314 -0
  46. {node v16.11 → node}/timers/promises.d.ts +0 -0
  47. node v16.11/timers.d.ts → node/timers.d.ts +1 -1
  48. node v16.11/tls.d.ts → node/tls.d.ts +32 -23
  49. node v16.11/trace_events.d.ts → node/trace_events.d.ts +11 -1
  50. node/ts4.8/assert/strict.d.ts +8 -0
  51. node/ts4.8/assert.d.ts +911 -0
  52. node/ts4.8/async_hooks.d.ts +501 -0
  53. node v16.11/buffer.d.ts → node/ts4.8/buffer.d.ts +46 -19
  54. node/ts4.8/child_process.d.ts +1369 -0
  55. node/ts4.8/cluster.d.ts +410 -0
  56. node/ts4.8/console.d.ts +412 -0
  57. node/ts4.8/constants.d.ts +18 -0
  58. node/ts4.8/crypto.d.ts +3964 -0
  59. node/ts4.8/dgram.d.ts +545 -0
  60. node/ts4.8/diagnostics_channel.d.ts +153 -0
  61. node/ts4.8/dns/promises.d.ts +370 -0
  62. node/ts4.8/dns.d.ts +659 -0
  63. node/ts4.8/dom-events.d.ts +126 -0
  64. node/ts4.8/domain.d.ts +170 -0
  65. node/ts4.8/events.d.ts +678 -0
  66. node/ts4.8/fs/promises.d.ts +1138 -0
  67. node/ts4.8/fs.d.ts +3872 -0
  68. node v16.11/globals.d.ts → node/ts4.8/globals.d.ts +14 -4
  69. node/ts4.8/globals.global.d.ts +1 -0
  70. node/ts4.8/http.d.ts +1607 -0
  71. node/ts4.8/http2.d.ts +2134 -0
  72. node/ts4.8/https.d.ts +541 -0
  73. node/ts4.8/index.d.ts +88 -0
  74. node/ts4.8/inspector.d.ts +2741 -0
  75. node/ts4.8/module.d.ts +114 -0
  76. node/ts4.8/net.d.ts +869 -0
  77. node/ts4.8/os.d.ts +466 -0
  78. node/ts4.8/path.d.ts +191 -0
  79. node/ts4.8/perf_hooks.d.ts +625 -0
  80. node/ts4.8/process.d.ts +1482 -0
  81. node/ts4.8/punycode.d.ts +117 -0
  82. node/ts4.8/querystring.d.ts +131 -0
  83. node/ts4.8/readline/promises.d.ts +143 -0
  84. node/ts4.8/readline.d.ts +653 -0
  85. node/ts4.8/repl.d.ts +424 -0
  86. node/ts4.8/stream/consumers.d.ts +12 -0
  87. node/ts4.8/stream/promises.d.ts +42 -0
  88. node/ts4.8/stream/web.d.ts +330 -0
  89. node/ts4.8/stream.d.ts +1340 -0
  90. node/ts4.8/string_decoder.d.ts +67 -0
  91. node/ts4.8/test.d.ts +314 -0
  92. node/ts4.8/timers/promises.d.ts +68 -0
  93. node/ts4.8/timers.d.ts +94 -0
  94. node/ts4.8/tls.d.ts +1028 -0
  95. node/ts4.8/trace_events.d.ts +171 -0
  96. node v16.11/tty.d.ts → node/ts4.8/tty.d.ts +4 -2
  97. node v16.11/url.d.ts → node/ts4.8/url.d.ts +85 -39
  98. node v16.11/util.d.ts → node/ts4.8/util.d.ts +268 -12
  99. node v16.11/v8.d.ts → node/ts4.8/v8.d.ts +21 -3
  100. node v16.11/vm.d.ts → node/ts4.8/vm.d.ts +6 -4
  101. node v16.11/wasi.d.ts → node/ts4.8/wasi.d.ts +1 -1
  102. node v16.11/worker_threads.d.ts → node/ts4.8/worker_threads.d.ts +50 -10
  103. node v16.11/zlib.d.ts → node/ts4.8/zlib.d.ts +1 -1
  104. node/tty.d.ts +206 -0
  105. node/url.d.ts +897 -0
  106. node/util.d.ts +1850 -0
  107. node/v8.d.ts +396 -0
  108. node/vm.d.ts +509 -0
  109. node/wasi.d.ts +158 -0
  110. node/worker_threads.d.ts +689 -0
  111. node/zlib.d.ts +517 -0
@@ -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.9.0/lib/http2.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/http2.js)
10
10
  */
11
11
  declare module 'http2' {
12
12
  import EventEmitter = require('node:events');
@@ -83,7 +83,7 @@ declare module 'http2' {
83
83
  */
84
84
  readonly destroyed: boolean;
85
85
  /**
86
- * Set the `true` if the `END_STREAM` flag was set in the request or response
86
+ * Set to `true` if the `END_STREAM` flag was set in the request or response
87
87
  * HEADERS frame received, indicating that no additional data should be received
88
88
  * and the readable side of the `Http2Stream` will be closed.
89
89
  * @since v10.11.0
@@ -758,7 +758,7 @@ declare module 'http2' {
758
758
  * session.setLocalWindowSize(expectedWindowSize);
759
759
  * });
760
760
  * ```
761
- * @since v15.3.0
761
+ * @since v15.3.0, v14.18.0
762
762
  */
763
763
  setLocalWindowSize(windowSize: number): void;
764
764
  /**
@@ -780,7 +780,7 @@ declare module 'http2' {
780
780
  * @since v8.4.0
781
781
  * @param callback Callback that is called once the session is connected or right away if the session is already connected.
782
782
  */
783
- settings(settings: Settings): void;
783
+ settings(settings: Settings, callback?: (err: Error | null, settings: Settings, duration: number) => void): void;
784
784
  /**
785
785
  * Calls `unref()` on this `Http2Session`instance's underlying `net.Socket`.
786
786
  * @since v9.4.0
@@ -846,6 +846,11 @@ declare module 'http2' {
846
846
  * For HTTP/2 Client `Http2Session` instances only, the `http2session.request()`creates and returns an `Http2Stream` instance that can be used to send an
847
847
  * HTTP/2 request to the connected server.
848
848
  *
849
+ * When a `ClientHttp2Session` is first created, the socket may not yet be
850
+ * connected. if `clienthttp2session.request()` is called during this time, the
851
+ * actual request will be deferred until the socket is ready to go.
852
+ * If the `session` is closed before the actual request be executed, an`ERR_HTTP2_GOAWAY_SESSION` is thrown.
853
+ *
849
854
  * This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`.
850
855
  *
851
856
  * ```js
@@ -1637,7 +1642,7 @@ declare module 'http2' {
1637
1642
  * be called multiple times to provide successive parts of the body.
1638
1643
  *
1639
1644
  * In the `http` module, the response body is omitted when the
1640
- * request is a HEAD request. Similarly, the `204` and `304` responses_must not_ include a message body.
1645
+ * request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body.
1641
1646
  *
1642
1647
  * `chunk` can be a string or a buffer. If `chunk` is a string,
1643
1648
  * the second parameter specifies how to encode it into a byte stream.
@@ -1665,6 +1670,34 @@ declare module 'http2' {
1665
1670
  * @since v8.4.0
1666
1671
  */
1667
1672
  writeContinue(): void;
1673
+ /**
1674
+ * Sends a status `103 Early Hints` to the client with a Link header,
1675
+ * indicating that the user agent can preload/preconnect the linked resources.
1676
+ * The `hints` is an object containing the values of headers to be sent with
1677
+ * early hints message.
1678
+ *
1679
+ * Example:
1680
+ *
1681
+ * ```js
1682
+ * const earlyHintsLink = '</styles.css>; rel=preload; as=style';
1683
+ * response.writeEarlyHints({
1684
+ * 'link': earlyHintsLink,
1685
+ * });
1686
+ *
1687
+ * const earlyHintsLinks = [
1688
+ * '</styles.css>; rel=preload; as=style',
1689
+ * '</scripts.js>; rel=preload; as=script',
1690
+ * ];
1691
+ * response.writeEarlyHints({
1692
+ * 'link': earlyHintsLinks,
1693
+ * 'x-trace-id': 'id for diagnostics'
1694
+ * });
1695
+ * ```
1696
+ *
1697
+ * @since v18.11.0
1698
+ * @param hints An object containing the values of headers
1699
+ */
1700
+ writeEarlyHints(hints: Record<string, string | string[]>): void;
1668
1701
  /**
1669
1702
  * Sends a response header to the request. The status code is a 3-digit HTTP
1670
1703
  * status code, like `404`. The last argument, `headers`, are the response headers.
@@ -1,14 +1,17 @@
1
1
  /**
2
2
  * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
3
3
  * separate module.
4
- * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/https.js)
4
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/https.js)
5
5
  */
6
6
  declare module 'https' {
7
7
  import { Duplex } from 'node:stream';
8
8
  import * as tls from 'node:tls';
9
9
  import * as http from 'node:http';
10
10
  import { URL } from 'node:url';
11
- type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions;
11
+ type ServerOptions<
12
+ Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
13
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
14
+ > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>;
12
15
  type RequestOptions = http.RequestOptions &
13
16
  tls.SecureContextOptions & {
14
17
  rejectUnauthorized?: boolean | undefined; // Defaults to true
@@ -26,35 +29,83 @@ declare module 'https' {
26
29
  constructor(options?: AgentOptions);
27
30
  options: AgentOptions;
28
31
  }
29
- interface Server extends http.Server {}
32
+ interface Server<
33
+ Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
34
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
35
+ > extends http.Server<Request, Response> {}
30
36
  /**
31
37
  * See `http.Server` for more information.
32
38
  * @since v0.3.4
33
39
  */
34
- class Server extends tls.Server {
35
- constructor(requestListener?: http.RequestListener);
36
- constructor(options: ServerOptions, requestListener?: http.RequestListener);
40
+ class Server<
41
+ Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
42
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
43
+ > extends tls.Server {
44
+ constructor(requestListener?: http.RequestListener<Request, Response>);
45
+ constructor(
46
+ options: ServerOptions<Request, Response>,
47
+ requestListener?: http.RequestListener<Request, Response>,
48
+ );
49
+ /**
50
+ * Closes all connections connected to this server.
51
+ * @since v18.2.0
52
+ */
53
+ closeAllConnections(): void;
54
+ /**
55
+ * Closes all connections connected to this server which are not sending a request or waiting for a response.
56
+ * @since v18.2.0
57
+ */
58
+ closeIdleConnections(): void;
37
59
  addListener(event: string, listener: (...args: any[]) => void): this;
38
60
  addListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
39
- addListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
40
- addListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
41
- addListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
61
+ addListener(
62
+ event: 'newSession',
63
+ listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
64
+ ): this;
65
+ addListener(
66
+ event: 'OCSPRequest',
67
+ listener: (
68
+ certificate: Buffer,
69
+ issuer: Buffer,
70
+ callback: (err: Error | null, resp: Buffer) => void,
71
+ ) => void,
72
+ ): this;
73
+ addListener(
74
+ event: 'resumeSession',
75
+ listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
76
+ ): this;
42
77
  addListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
43
78
  addListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
44
79
  addListener(event: 'close', listener: () => void): this;
45
80
  addListener(event: 'connection', listener: (socket: Duplex) => void): this;
46
81
  addListener(event: 'error', listener: (err: Error) => void): this;
47
82
  addListener(event: 'listening', listener: () => void): this;
48
- addListener(event: 'checkContinue', listener: http.RequestListener): this;
49
- addListener(event: 'checkExpectation', listener: http.RequestListener): this;
83
+ addListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
84
+ addListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
50
85
  addListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
51
- addListener(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
52
- addListener(event: 'request', listener: http.RequestListener): this;
53
- addListener(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
86
+ addListener(
87
+ event: 'connect',
88
+ listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
89
+ ): this;
90
+ addListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
91
+ addListener(
92
+ event: 'upgrade',
93
+ listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
94
+ ): this;
54
95
  emit(event: string, ...args: any[]): boolean;
55
96
  emit(event: 'keylog', line: Buffer, tlsSocket: tls.TLSSocket): boolean;
56
- emit(event: 'newSession', sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void): boolean;
57
- emit(event: 'OCSPRequest', certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean;
97
+ emit(
98
+ event: 'newSession',
99
+ sessionId: Buffer,
100
+ sessionData: Buffer,
101
+ callback: (err: Error, resp: Buffer) => void,
102
+ ): boolean;
103
+ emit(
104
+ event: 'OCSPRequest',
105
+ certificate: Buffer,
106
+ issuer: Buffer,
107
+ callback: (err: Error | null, resp: Buffer) => void,
108
+ ): boolean;
58
109
  emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean;
59
110
  emit(event: 'secureConnection', tlsSocket: tls.TLSSocket): boolean;
60
111
  emit(event: 'tlsClientError', err: Error, tlsSocket: tls.TLSSocket): boolean;
@@ -62,80 +113,156 @@ declare module 'https' {
62
113
  emit(event: 'connection', socket: Duplex): boolean;
63
114
  emit(event: 'error', err: Error): boolean;
64
115
  emit(event: 'listening'): boolean;
65
- emit(event: 'checkContinue', req: http.IncomingMessage, res: http.ServerResponse): boolean;
66
- emit(event: 'checkExpectation', req: http.IncomingMessage, res: http.ServerResponse): boolean;
116
+ emit(
117
+ event: 'checkContinue',
118
+ req: InstanceType<Request>,
119
+ res: InstanceType<Response> & { req: InstanceType<Request> },
120
+ ): boolean;
121
+ emit(
122
+ event: 'checkExpectation',
123
+ req: InstanceType<Request>,
124
+ res: InstanceType<Response> & { req: InstanceType<Request> },
125
+ ): boolean;
67
126
  emit(event: 'clientError', err: Error, socket: Duplex): boolean;
68
- emit(event: 'connect', req: http.IncomingMessage, socket: Duplex, head: Buffer): boolean;
69
- emit(event: 'request', req: http.IncomingMessage, res: http.ServerResponse): boolean;
70
- emit(event: 'upgrade', req: http.IncomingMessage, socket: Duplex, head: Buffer): boolean;
127
+ emit(event: 'connect', req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
128
+ emit(
129
+ event: 'request',
130
+ req: InstanceType<Request>,
131
+ res: InstanceType<Response> & { req: InstanceType<Request> },
132
+ ): boolean;
133
+ emit(event: 'upgrade', req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
71
134
  on(event: string, listener: (...args: any[]) => void): this;
72
135
  on(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
73
- on(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
74
- on(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
75
- on(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
136
+ on(
137
+ event: 'newSession',
138
+ listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
139
+ ): this;
140
+ on(
141
+ event: 'OCSPRequest',
142
+ listener: (
143
+ certificate: Buffer,
144
+ issuer: Buffer,
145
+ callback: (err: Error | null, resp: Buffer) => void,
146
+ ) => void,
147
+ ): this;
148
+ on(
149
+ event: 'resumeSession',
150
+ listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
151
+ ): this;
76
152
  on(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
77
153
  on(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
78
154
  on(event: 'close', listener: () => void): this;
79
155
  on(event: 'connection', listener: (socket: Duplex) => void): this;
80
156
  on(event: 'error', listener: (err: Error) => void): this;
81
157
  on(event: 'listening', listener: () => void): this;
82
- on(event: 'checkContinue', listener: http.RequestListener): this;
83
- on(event: 'checkExpectation', listener: http.RequestListener): this;
158
+ on(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
159
+ on(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
84
160
  on(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
85
- on(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
86
- on(event: 'request', listener: http.RequestListener): this;
87
- on(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
161
+ on(event: 'connect', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
162
+ on(event: 'request', listener: http.RequestListener<Request, Response>): this;
163
+ on(event: 'upgrade', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
88
164
  once(event: string, listener: (...args: any[]) => void): this;
89
165
  once(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
90
- once(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
91
- once(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
92
- once(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
166
+ once(
167
+ event: 'newSession',
168
+ listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
169
+ ): this;
170
+ once(
171
+ event: 'OCSPRequest',
172
+ listener: (
173
+ certificate: Buffer,
174
+ issuer: Buffer,
175
+ callback: (err: Error | null, resp: Buffer) => void,
176
+ ) => void,
177
+ ): this;
178
+ once(
179
+ event: 'resumeSession',
180
+ listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
181
+ ): this;
93
182
  once(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
94
183
  once(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
95
184
  once(event: 'close', listener: () => void): this;
96
185
  once(event: 'connection', listener: (socket: Duplex) => void): this;
97
186
  once(event: 'error', listener: (err: Error) => void): this;
98
187
  once(event: 'listening', listener: () => void): this;
99
- once(event: 'checkContinue', listener: http.RequestListener): this;
100
- once(event: 'checkExpectation', listener: http.RequestListener): this;
188
+ once(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
189
+ once(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
101
190
  once(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
102
- once(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
103
- once(event: 'request', listener: http.RequestListener): this;
104
- once(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
191
+ once(event: 'connect', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
192
+ once(event: 'request', listener: http.RequestListener<Request, Response>): this;
193
+ once(event: 'upgrade', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
105
194
  prependListener(event: string, listener: (...args: any[]) => void): this;
106
195
  prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
107
- prependListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
108
- prependListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
109
- prependListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
196
+ prependListener(
197
+ event: 'newSession',
198
+ listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
199
+ ): this;
200
+ prependListener(
201
+ event: 'OCSPRequest',
202
+ listener: (
203
+ certificate: Buffer,
204
+ issuer: Buffer,
205
+ callback: (err: Error | null, resp: Buffer) => void,
206
+ ) => void,
207
+ ): this;
208
+ prependListener(
209
+ event: 'resumeSession',
210
+ listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
211
+ ): this;
110
212
  prependListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
111
213
  prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
112
214
  prependListener(event: 'close', listener: () => void): this;
113
215
  prependListener(event: 'connection', listener: (socket: Duplex) => void): this;
114
216
  prependListener(event: 'error', listener: (err: Error) => void): this;
115
217
  prependListener(event: 'listening', listener: () => void): this;
116
- prependListener(event: 'checkContinue', listener: http.RequestListener): this;
117
- prependListener(event: 'checkExpectation', listener: http.RequestListener): this;
218
+ prependListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
219
+ prependListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
118
220
  prependListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
119
- prependListener(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
120
- prependListener(event: 'request', listener: http.RequestListener): this;
121
- prependListener(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
221
+ prependListener(
222
+ event: 'connect',
223
+ listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
224
+ ): this;
225
+ prependListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
226
+ prependListener(
227
+ event: 'upgrade',
228
+ listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
229
+ ): this;
122
230
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
123
231
  prependOnceListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
124
- prependOnceListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this;
125
- prependOnceListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
126
- prependOnceListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
232
+ prependOnceListener(
233
+ event: 'newSession',
234
+ listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
235
+ ): this;
236
+ prependOnceListener(
237
+ event: 'OCSPRequest',
238
+ listener: (
239
+ certificate: Buffer,
240
+ issuer: Buffer,
241
+ callback: (err: Error | null, resp: Buffer) => void,
242
+ ) => void,
243
+ ): this;
244
+ prependOnceListener(
245
+ event: 'resumeSession',
246
+ listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
247
+ ): this;
127
248
  prependOnceListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
128
249
  prependOnceListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
129
250
  prependOnceListener(event: 'close', listener: () => void): this;
130
251
  prependOnceListener(event: 'connection', listener: (socket: Duplex) => void): this;
131
252
  prependOnceListener(event: 'error', listener: (err: Error) => void): this;
132
253
  prependOnceListener(event: 'listening', listener: () => void): this;
133
- prependOnceListener(event: 'checkContinue', listener: http.RequestListener): this;
134
- prependOnceListener(event: 'checkExpectation', listener: http.RequestListener): this;
254
+ prependOnceListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
255
+ prependOnceListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
135
256
  prependOnceListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
136
- prependOnceListener(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
137
- prependOnceListener(event: 'request', listener: http.RequestListener): this;
138
- prependOnceListener(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
257
+ prependOnceListener(
258
+ event: 'connect',
259
+ listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
260
+ ): this;
261
+ prependOnceListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
262
+ prependOnceListener(
263
+ event: 'upgrade',
264
+ listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
265
+ ): this;
139
266
  }
140
267
  /**
141
268
  * ```js
@@ -174,8 +301,17 @@ declare module 'https' {
174
301
  * @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`.
175
302
  * @param requestListener A listener to be added to the `'request'` event.
176
303
  */
177
- function createServer(requestListener?: http.RequestListener): Server;
178
- function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server;
304
+ function createServer<
305
+ Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
306
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
307
+ >(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
308
+ function createServer<
309
+ Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
310
+ Response extends typeof http.ServerResponse = typeof http.ServerResponse,
311
+ >(
312
+ options: ServerOptions<Request, Response>,
313
+ requestListener?: http.RequestListener<Request, Response>,
314
+ ): Server<Request, Response>;
179
315
  /**
180
316
  * Makes a request to a secure web server.
181
317
  *
@@ -356,8 +492,15 @@ declare module 'https' {
356
492
  * @since v0.3.6
357
493
  * @param options Accepts all `options` from `request`, with some differences in default values:
358
494
  */
359
- function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
360
- function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
495
+ function request(
496
+ options: RequestOptions | string | URL,
497
+ callback?: (res: http.IncomingMessage) => void,
498
+ ): http.ClientRequest;
499
+ function request(
500
+ url: string | URL,
501
+ options: RequestOptions,
502
+ callback?: (res: http.IncomingMessage) => void,
503
+ ): http.ClientRequest;
361
504
  /**
362
505
  * Like `http.get()` but for HTTPS.
363
506
  *
@@ -382,8 +525,15 @@ declare module 'https' {
382
525
  * @since v0.3.6
383
526
  * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`.
384
527
  */
385
- function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
386
- function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
528
+ function get(
529
+ options: RequestOptions | string | URL,
530
+ callback?: (res: http.IncomingMessage) => void,
531
+ ): http.ClientRequest;
532
+ function get(
533
+ url: string | URL,
534
+ options: RequestOptions,
535
+ callback?: (res: http.IncomingMessage) => void,
536
+ ): http.ClientRequest;
387
537
  let globalAgent: Agent;
388
538
  }
389
539
  declare module 'node:https' {
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 16.11
1
+ // Type definitions for non-npm package Node.js 18.11
2
2
  // Project: https://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
@@ -21,7 +21,6 @@
21
21
  // Nikita Galkin <https://github.com/galkin>
22
22
  // Parambir Singh <https://github.com/parambirs>
23
23
  // Sebastian Silbermann <https://github.com/eps1lon>
24
- // Seth Westphal <https://github.com/westy92>
25
24
  // Simon Schick <https://github.com/SimonSchick>
26
25
  // Thomas den Hollander <https://github.com/ThomasdenH>
27
26
  // Wilco Bakker <https://github.com/WilcoBakker>
@@ -41,6 +40,7 @@
41
40
  // NodeJS Contributors <https://github.com/NodeJS>
42
41
  // Linus Unnebäck <https://github.com/LinusU>
43
42
  // wafuwafu13 <https://github.com/wafuwafu13>
43
+ // Matteo Collina <https://github.com/mcollina>
44
44
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
45
45
 
46
46
  /**
@@ -67,7 +67,7 @@
67
67
  * IN THE SOFTWARE.
68
68
  */
69
69
 
70
- // NOTE: These definitions support NodeJS and TypeScript 3.7+.
70
+ // NOTE: These definitions support NodeJS and TypeScript 4.9+.
71
71
 
72
72
  // Reference required types from the default lib:
73
73
  /// <reference lib="es2020" />
@@ -92,6 +92,7 @@
92
92
  /// <reference path="dns/promises.d.ts" />
93
93
  /// <reference path="dns/promises.d.ts" />
94
94
  /// <reference path="domain.d.ts" />
95
+ /// <reference path="dom-events.d.ts" />
95
96
  /// <reference path="events.d.ts" />
96
97
  /// <reference path="fs.d.ts" />
97
98
  /// <reference path="fs/promises.d.ts" />
@@ -108,12 +109,14 @@
108
109
  /// <reference path="punycode.d.ts" />
109
110
  /// <reference path="querystring.d.ts" />
110
111
  /// <reference path="readline.d.ts" />
112
+ /// <reference path="readline/promises.d.ts" />
111
113
  /// <reference path="repl.d.ts" />
112
114
  /// <reference path="stream.d.ts" />
113
115
  /// <reference path="stream/promises.d.ts" />
114
116
  /// <reference path="stream/consumers.d.ts" />
115
117
  /// <reference path="stream/web.d.ts" />
116
118
  /// <reference path="string_decoder.d.ts" />
119
+ /// <reference path="test.d.ts" />
117
120
  /// <reference path="timers.d.ts" />
118
121
  /// <reference path="timers/promises.d.ts" />
119
122
  /// <reference path="tls.d.ts" />
@@ -1,4 +1,4 @@
1
- // tslint:disable-next-line:dt-header
1
+ // eslint-disable-next-line dt-header
2
2
  // Type definitions for inspector
3
3
 
4
4
  // These definitions are auto-generated.
@@ -15,7 +15,7 @@
15
15
  * ```js
16
16
  * const inspector = require('inspector');
17
17
  * ```
18
- * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/inspector.js)
18
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/inspector.js)
19
19
  */
20
20
  declare module 'inspector' {
21
21
  import EventEmitter = require('node:events');
@@ -1688,7 +1688,7 @@ declare module 'inspector' {
1688
1688
  /**
1689
1689
  * Controls how the trace buffer stores data.
1690
1690
  */
1691
- recordMode?: string;
1691
+ recordMode?: string | undefined;
1692
1692
  /**
1693
1693
  * Included category filters.
1694
1694
  */
@@ -1778,13 +1778,6 @@ declare module 'inspector' {
1778
1778
  * @since v8.0.0
1779
1779
  */
1780
1780
  connect(): void;
1781
- /**
1782
- * Connects a session to the main thread inspector back-end.
1783
- * An exception will be thrown if this API was not called on a Worker
1784
- * thread.
1785
- * @since v12.11.0
1786
- */
1787
- connectToMainThread(): void;
1788
1781
  /**
1789
1782
  * Immediately close the session. All pending message callbacks will be called
1790
1783
  * with an error. `session.connect()` will need to be called to be able to send
@@ -2696,7 +2689,7 @@ declare module 'inspector' {
2696
2689
  prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this;
2697
2690
  }
2698
2691
  /**
2699
- * Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has
2692
+ * Activate inspector on host and port. Equivalent to`node --inspect=[[host:]port]`, but can be done programmatically after node has
2700
2693
  * started.
2701
2694
  *
2702
2695
  * If wait is `true`, will block until a client has connected to the inspect port
@@ -2718,12 +2711,12 @@ declare module 'inspector' {
2718
2711
  * ```console
2719
2712
  * $ node --inspect -p 'inspector.url()'
2720
2713
  * Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
2721
- * For help see https://nodejs.org/en/docs/inspector
2714
+ * For help, see: https://nodejs.org/en/docs/inspector
2722
2715
  * ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
2723
2716
  *
2724
2717
  * $ node --inspect=localhost:3000 -p 'inspector.url()'
2725
2718
  * Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
2726
- * For help see https://nodejs.org/en/docs/inspector
2719
+ * For help, see: https://nodejs.org/en/docs/inspector
2727
2720
  * ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
2728
2721
  *
2729
2722
  * $ node -p 'inspector.url()'
@@ -2739,7 +2732,10 @@ declare module 'inspector' {
2739
2732
  */
2740
2733
  function waitForDebugger(): void;
2741
2734
  }
2735
+ /**
2736
+ * The inspector module provides an API for interacting with the V8 inspector.
2737
+ */
2742
2738
  declare module 'node:inspector' {
2743
- import EventEmitter = require('inspector');
2744
- export = EventEmitter;
2739
+ import inspector = require('inspector');
2740
+ export = inspector;
2745
2741
  }
File without changes