@types/node 16.4.8 → 16.4.12

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/fs/promises.d.ts CHANGED
@@ -108,8 +108,8 @@ declare module 'fs/promises' {
108
108
  * number of bytes read is zero.
109
109
  * @since v10.0.0
110
110
  * @param buffer A buffer that will be filled with the file data read.
111
- * @param offset The location in the buffer at which to start filling.
112
- * @param length The number of bytes to read.
111
+ * @param [offset=0] The location in the buffer at which to start filling.
112
+ * @param [length=buffer.byteLength] The number of bytes to read.
113
113
  * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an
114
114
  * integer, the current file position will remain unchanged.
115
115
  * @return Fulfills upon success with an object with two properties:
@@ -204,6 +204,7 @@ declare module 'fs/promises' {
204
204
  *
205
205
  * If `len` is negative then `0` will be used.
206
206
  * @since v10.0.0
207
+ * @param [len=0]
207
208
  * @return Fulfills with `undefined` upon success.
208
209
  */
209
210
  truncate(len?: number): Promise<void>;
@@ -242,8 +243,8 @@ declare module 'fs/promises' {
242
243
  * The kernel ignores the position argument and always appends the data to
243
244
  * the end of the file.
244
245
  * @since v10.0.0
245
- * @param offset The start position from within `buffer` where the data to write begins.
246
- * @param length The number of bytes from `buffer` to write.
246
+ * @param [offset=0] The start position from within `buffer` where the data to write begins.
247
+ * @param [length=buffer.byteLength] The number of bytes from `buffer` to write.
247
248
  * @param position The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current position.
248
249
  * See the POSIX pwrite(2) documentation for more detail.
249
250
  */
@@ -336,6 +337,7 @@ declare module 'fs/promises' {
336
337
  * calls. Instead, user code should open/read/write the file directly and handle
337
338
  * the error raised if the file is not accessible.
338
339
  * @since v10.0.0
340
+ * @param [mode=fs.constants.F_OK]
339
341
  * @return Fulfills with `undefined` upon success.
340
342
  */
341
343
  function access(path: PathLike, mode?: number): Promise<void>;
@@ -369,7 +371,7 @@ declare module 'fs/promises' {
369
371
  * @since v10.0.0
370
372
  * @param src source filename to copy
371
373
  * @param dest destination filename of the copy operation
372
- * @param mode Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g.
374
+ * @param [mode=0] Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g.
373
375
  * `fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`)
374
376
  * @return Fulfills with `undefined` upon success.
375
377
  */
@@ -383,8 +385,8 @@ declare module 'fs/promises' {
383
385
  * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains
384
386
  * a colon, Node.js will open a file system stream, as described by[this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams).
385
387
  * @since v10.0.0
386
- * @param flags See `support of file system `flags``.
387
- * @param mode Sets the file mode (permission and sticky bits) if the file is created.
388
+ * @param [flags='r'] See `support of file system `flags``.
389
+ * @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created.
388
390
  * @return Fulfills with a {FileHandle} object.
389
391
  */
390
392
  function open(path: PathLike, flags: string | number, mode?: Mode): Promise<FileHandle>;
@@ -397,6 +399,7 @@ declare module 'fs/promises' {
397
399
  /**
398
400
  * Truncates (shortens or extends the length) of the content at `path` to `len`bytes.
399
401
  * @since v10.0.0
402
+ * @param [len=0]
400
403
  * @return Fulfills with `undefined` upon success.
401
404
  */
402
405
  function truncate(path: PathLike, len?: number): Promise<void>;
@@ -558,6 +561,7 @@ declare module 'fs/promises' {
558
561
  * to be absolute. When using `'junction'`, the `target` argument will
559
562
  * automatically be normalized to absolute path.
560
563
  * @since v10.0.0
564
+ * @param [type='file']
561
565
  * @return Fulfills with `undefined` upon success.
562
566
  */
563
567
  function symlink(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
node/fs.d.ts CHANGED
@@ -516,6 +516,7 @@ declare module 'fs' {
516
516
  *
517
517
  * See the POSIX [`truncate(2)`](http://man7.org/linux/man-pages/man2/truncate.2.html) documentation for more details.
518
518
  * @since v0.8.6
519
+ * @param [len=0]
519
520
  */
520
521
  export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void;
521
522
  /**
@@ -538,6 +539,7 @@ declare module 'fs' {
538
539
  * Passing a file descriptor is deprecated and may result in an error being thrown
539
540
  * in the future.
540
541
  * @since v0.8.6
542
+ * @param [len=0]
541
543
  */
542
544
  export function truncateSync(path: PathLike, len?: number | null): void;
543
545
  /**
@@ -581,6 +583,7 @@ declare module 'fs' {
581
583
  *
582
584
  * If `len` is negative then `0` will be used.
583
585
  * @since v0.8.6
586
+ * @param [len=0]
584
587
  */
585
588
  export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void;
586
589
  /**
@@ -602,6 +605,7 @@ declare module 'fs' {
602
605
  * For detailed information, see the documentation of the asynchronous version of
603
606
  * this API: {@link ftruncate}.
604
607
  * @since v0.8.6
608
+ * @param [len=0]
605
609
  */
606
610
  export function ftruncateSync(fd: number, len?: number | null): void;
607
611
  /**
@@ -1952,7 +1956,8 @@ declare module 'fs' {
1952
1956
  *
1953
1957
  * Functions based on `fs.open()` exhibit this behavior as well:`fs.writeFile()`, `fs.readFile()`, etc.
1954
1958
  * @since v0.0.2
1955
- * @param flags See `support of file system `flags``.
1959
+ * @param [flags='r'] See `support of file system `flags``.
1960
+ * @param [mode=0o666]
1956
1961
  */
1957
1962
  export function open(path: PathLike, flags: OpenMode, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
1958
1963
  /**
@@ -1974,6 +1979,8 @@ declare module 'fs' {
1974
1979
  * For detailed information, see the documentation of the asynchronous version of
1975
1980
  * this API: {@link open}.
1976
1981
  * @since v0.1.21
1982
+ * @param [flags='r']
1983
+ * @param [mode=0o666]
1977
1984
  */
1978
1985
  export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
1979
1986
  /**
@@ -2196,9 +2203,9 @@ declare module 'fs' {
2196
2203
  * If this method is invoked as its `util.promisify()` ed version, it returns
2197
2204
  * a promise for an `Object` with `bytesRead` and `buffer` properties.
2198
2205
  * @since v0.0.2
2199
- * @param buffer The buffer that the data will be written to.
2200
- * @param offset The position in `buffer` to write the data to.
2201
- * @param length The number of bytes to read.
2206
+ * @param [buffer=Buffer.alloc(16384)] The buffer that the data will be written to.
2207
+ * @param [offset=0] The position in `buffer` to write the data to.
2208
+ * @param [length=buffer.byteLength] The number of bytes to read.
2202
2209
  * @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If
2203
2210
  * `position` is an integer, the file position will be unchanged.
2204
2211
  */
@@ -2347,7 +2354,7 @@ declare module 'fs' {
2347
2354
  encoding: BufferEncoding;
2348
2355
  flag?: string | undefined;
2349
2356
  } & Abortable)
2350
- | string,
2357
+ | BufferEncoding,
2351
2358
  callback: (err: NodeJS.ErrnoException | null, data: string) => void
2352
2359
  ): void;
2353
2360
  /**
@@ -2363,7 +2370,7 @@ declare module 'fs' {
2363
2370
  | (ObjectEncodingOptions & {
2364
2371
  flag?: string | undefined;
2365
2372
  } & Abortable)
2366
- | string
2373
+ | BufferEncoding
2367
2374
  | undefined
2368
2375
  | null,
2369
2376
  callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void
@@ -2404,7 +2411,7 @@ declare module 'fs' {
2404
2411
  encoding: BufferEncoding;
2405
2412
  flag?: string | undefined;
2406
2413
  }
2407
- | string
2414
+ | BufferEncoding
2408
2415
  ): Promise<string>;
2409
2416
  /**
2410
2417
  * Asynchronously reads the entire contents of a file.
@@ -2420,7 +2427,7 @@ declare module 'fs' {
2420
2427
  | (ObjectEncodingOptions & {
2421
2428
  flag?: string | undefined;
2422
2429
  })
2423
- | string
2430
+ | BufferEncoding
2424
2431
  | null
2425
2432
  ): Promise<string | Buffer>;
2426
2433
  }
@@ -2493,7 +2500,7 @@ declare module 'fs' {
2493
2500
  mode?: Mode | undefined;
2494
2501
  flag?: string | undefined;
2495
2502
  })
2496
- | string
2503
+ | BufferEncoding
2497
2504
  | null;
2498
2505
  /**
2499
2506
  * When `file` is a filename, asynchronously writes data to the file, replacing the
@@ -2803,6 +2810,7 @@ declare module 'fs' {
2803
2810
  * If a `signal` is passed, aborting the corresponding AbortController will close
2804
2811
  * the returned `<fs.FSWatcher>`.
2805
2812
  * @since v0.5.10
2813
+ * @param listener
2806
2814
  */
2807
2815
  export function watch(
2808
2816
  filename: PathLike,
@@ -3268,6 +3276,7 @@ declare module 'fs' {
3268
3276
  * ACL and therefore may report that a path is accessible even if the ACL restricts
3269
3277
  * the user from reading or writing to it.
3270
3278
  * @since v0.11.15
3279
+ * @param [mode=fs.constants.F_OK]
3271
3280
  */
3272
3281
  export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
3273
3282
  /**
@@ -3305,6 +3314,7 @@ declare module 'fs' {
3305
3314
  * }
3306
3315
  * ```
3307
3316
  * @since v0.11.15
3317
+ * @param [mode=fs.constants.F_OK]
3308
3318
  */
3309
3319
  export function accessSync(path: PathLike, mode?: number): void;
3310
3320
  interface StreamOptions {
@@ -3474,7 +3484,7 @@ declare module 'fs' {
3474
3484
  * @since v8.5.0
3475
3485
  * @param src source filename to copy
3476
3486
  * @param dest destination filename of the copy operation
3477
- * @param mode modifiers for copy operation.
3487
+ * @param [mode=0] modifiers for copy operation.
3478
3488
  */
3479
3489
  export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
3480
3490
  export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
@@ -3513,7 +3523,7 @@ declare module 'fs' {
3513
3523
  * @since v8.5.0
3514
3524
  * @param src source filename to copy
3515
3525
  * @param dest destination filename of the copy operation
3516
- * @param mode modifiers for copy operation.
3526
+ * @param [mode=0] modifiers for copy operation.
3517
3527
  */
3518
3528
  export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
3519
3529
  /**
node/http.d.ts CHANGED
@@ -156,7 +156,12 @@ 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);
160
165
  setTimeout(msecs?: number, callback?: () => void): this;
161
166
  setTimeout(callback: () => void): this;
162
167
  /**
@@ -179,14 +184,72 @@ declare module 'http' {
179
184
  * {@link https://nodejs.org/api/http.html#http_server_requesttimeout}
180
185
  */
181
186
  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);
187
+ addListener(event: string, listener: (...args: any[]) => void): this;
188
+ addListener(event: 'close', listener: () => void): this;
189
+ addListener(event: 'connection', listener: (socket: Socket) => void): this;
190
+ addListener(event: 'error', listener: (err: Error) => void): this;
191
+ addListener(event: 'listening', listener: () => void): this;
192
+ addListener(event: 'checkContinue', listener: RequestListener): this;
193
+ addListener(event: 'checkExpectation', listener: RequestListener): this;
194
+ addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
195
+ addListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
196
+ addListener(event: 'request', listener: RequestListener): this;
197
+ addListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
198
+ emit(event: string, ...args: any[]): boolean;
199
+ emit(event: 'close'): boolean;
200
+ emit(event: 'connection', socket: Socket): boolean;
201
+ emit(event: 'error', err: Error): boolean;
202
+ emit(event: 'listening'): boolean;
203
+ emit(event: 'checkContinue', req: IncomingMessage, res: ServerResponse): boolean;
204
+ emit(event: 'checkExpectation', req: IncomingMessage, res: ServerResponse): boolean;
205
+ emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean;
206
+ emit(event: 'connect', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
207
+ emit(event: 'request', req: IncomingMessage, res: ServerResponse): boolean;
208
+ emit(event: 'upgrade', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
209
+ on(event: string, listener: (...args: any[]) => void): this;
210
+ on(event: 'close', listener: () => void): this;
211
+ on(event: 'connection', listener: (socket: Socket) => void): this;
212
+ on(event: 'error', listener: (err: Error) => void): this;
213
+ on(event: 'listening', listener: () => void): this;
214
+ on(event: 'checkContinue', listener: RequestListener): this;
215
+ on(event: 'checkExpectation', listener: RequestListener): this;
216
+ on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
217
+ on(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
218
+ on(event: 'request', listener: RequestListener): this;
219
+ on(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
220
+ once(event: string, listener: (...args: any[]) => void): this;
221
+ once(event: 'close', listener: () => void): this;
222
+ once(event: 'connection', listener: (socket: Socket) => void): this;
223
+ once(event: 'error', listener: (err: Error) => void): this;
224
+ once(event: 'listening', listener: () => void): this;
225
+ once(event: 'checkContinue', listener: RequestListener): this;
226
+ once(event: 'checkExpectation', listener: RequestListener): this;
227
+ once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
228
+ once(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
229
+ once(event: 'request', listener: RequestListener): this;
230
+ once(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
231
+ prependListener(event: string, listener: (...args: any[]) => void): this;
232
+ prependListener(event: 'close', listener: () => void): this;
233
+ prependListener(event: 'connection', listener: (socket: Socket) => void): this;
234
+ prependListener(event: 'error', listener: (err: Error) => void): this;
235
+ prependListener(event: 'listening', listener: () => void): this;
236
+ prependListener(event: 'checkContinue', listener: RequestListener): this;
237
+ prependListener(event: 'checkExpectation', listener: RequestListener): this;
238
+ prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
239
+ prependListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
240
+ prependListener(event: 'request', listener: RequestListener): this;
241
+ prependListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
242
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
243
+ prependOnceListener(event: 'close', listener: () => void): this;
244
+ prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
245
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
246
+ prependOnceListener(event: 'listening', listener: () => void): this;
247
+ prependOnceListener(event: 'checkContinue', listener: RequestListener): this;
248
+ prependOnceListener(event: 'checkExpectation', listener: RequestListener): this;
249
+ prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
250
+ prependOnceListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
251
+ prependOnceListener(event: 'request', listener: RequestListener): this;
252
+ prependOnceListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
190
253
  }
191
254
  /**
192
255
  * 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
@@ -140,7 +140,7 @@ declare module 'http2' {
140
140
  * Closes the `Http2Stream` instance by sending an `RST_STREAM` frame to the
141
141
  * connected HTTP/2 peer.
142
142
  * @since v8.4.0
143
- * @param code Unsigned 32-bit integer identifying the error code.
143
+ * @param [code=http2.constants.NGHTTP2_NO_ERROR] Unsigned 32-bit integer identifying the error code.
144
144
  * @param callback An optional function registered to listen for the `'close'` event.
145
145
  */
146
146
  close(code?: number, callback?: () => void): void;
node/https.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/https.js)
5
5
  */
6
6
  declare module 'https' {
7
+ import { Duplex } from 'node:stream';
7
8
  import * as tls from 'node:tls';
8
9
  import * as http from 'node:http';
9
10
  import { URL } from 'node:url';
@@ -25,7 +26,7 @@ declare module 'https' {
25
26
  constructor(options?: AgentOptions);
26
27
  options: AgentOptions;
27
28
  }
28
- interface Server extends http.HttpBase {}
29
+ interface Server extends http.Server {}
29
30
  /**
30
31
  * See `http.Server` for more information.
31
32
  * @since v0.3.4
@@ -33,6 +34,108 @@ declare module 'https' {
33
34
  class Server extends tls.Server {
34
35
  constructor(requestListener?: http.RequestListener);
35
36
  constructor(options: ServerOptions, requestListener?: http.RequestListener);
37
+ addListener(event: string, listener: (...args: any[]) => void): this;
38
+ 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;
42
+ addListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
43
+ addListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
44
+ addListener(event: 'close', listener: () => void): this;
45
+ addListener(event: 'connection', listener: (socket: Duplex) => void): this;
46
+ addListener(event: 'error', listener: (err: Error) => void): this;
47
+ addListener(event: 'listening', listener: () => void): this;
48
+ addListener(event: 'checkContinue', listener: http.RequestListener): this;
49
+ addListener(event: 'checkExpectation', listener: http.RequestListener): this;
50
+ 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;
54
+ emit(event: string, ...args: any[]): boolean;
55
+ 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;
58
+ emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean;
59
+ emit(event: 'secureConnection', tlsSocket: tls.TLSSocket): boolean;
60
+ emit(event: 'tlsClientError', err: Error, tlsSocket: tls.TLSSocket): boolean;
61
+ emit(event: 'close'): boolean;
62
+ emit(event: 'connection', socket: Duplex): boolean;
63
+ emit(event: 'error', err: Error): boolean;
64
+ 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;
67
+ 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;
71
+ on(event: string, listener: (...args: any[]) => void): this;
72
+ 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;
76
+ on(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
77
+ on(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
78
+ on(event: 'close', listener: () => void): this;
79
+ on(event: 'connection', listener: (socket: Duplex) => void): this;
80
+ on(event: 'error', listener: (err: Error) => void): this;
81
+ on(event: 'listening', listener: () => void): this;
82
+ on(event: 'checkContinue', listener: http.RequestListener): this;
83
+ on(event: 'checkExpectation', listener: http.RequestListener): this;
84
+ 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;
88
+ once(event: string, listener: (...args: any[]) => void): this;
89
+ 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;
93
+ once(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
94
+ once(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
95
+ once(event: 'close', listener: () => void): this;
96
+ once(event: 'connection', listener: (socket: Duplex) => void): this;
97
+ once(event: 'error', listener: (err: Error) => void): this;
98
+ once(event: 'listening', listener: () => void): this;
99
+ once(event: 'checkContinue', listener: http.RequestListener): this;
100
+ once(event: 'checkExpectation', listener: http.RequestListener): this;
101
+ 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;
105
+ prependListener(event: string, listener: (...args: any[]) => void): this;
106
+ 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;
110
+ prependListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
111
+ prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
112
+ prependListener(event: 'close', listener: () => void): this;
113
+ prependListener(event: 'connection', listener: (socket: Duplex) => void): this;
114
+ prependListener(event: 'error', listener: (err: Error) => void): this;
115
+ prependListener(event: 'listening', listener: () => void): this;
116
+ prependListener(event: 'checkContinue', listener: http.RequestListener): this;
117
+ prependListener(event: 'checkExpectation', listener: http.RequestListener): this;
118
+ 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;
122
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
123
+ 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;
127
+ prependOnceListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
128
+ prependOnceListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
129
+ prependOnceListener(event: 'close', listener: () => void): this;
130
+ prependOnceListener(event: 'connection', listener: (socket: Duplex) => void): this;
131
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
132
+ prependOnceListener(event: 'listening', listener: () => void): this;
133
+ prependOnceListener(event: 'checkContinue', listener: http.RequestListener): this;
134
+ prependOnceListener(event: 'checkExpectation', listener: http.RequestListener): this;
135
+ 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;
36
139
  }
37
140
  /**
38
141
  * ```js
node/index.d.ts CHANGED
@@ -42,6 +42,7 @@
42
42
  // Victor Perin <https://github.com/victorperin>
43
43
  // Yongsheng Zhang <https://github.com/ZYSzys>
44
44
  // NodeJS Contributors <https://github.com/NodeJS>
45
+ // Linus Unnebäck <https://github.com/LinusU>
45
46
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
46
47
 
47
48
  /**
node/net.d.ts CHANGED
@@ -87,7 +87,7 @@ declare module 'net' {
87
87
  * See `Writable` stream `write()` method for more
88
88
  * information.
89
89
  * @since v0.1.90
90
- * @param encoding Only used when data is `string`.
90
+ * @param [encoding='utf8'] Only used when data is `string`.
91
91
  */
92
92
  write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
93
93
  write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean;
@@ -165,6 +165,7 @@ declare module 'net' {
165
165
  * algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's
166
166
  * algorithm.
167
167
  * @since v0.1.90
168
+ * @param [noDelay=true]
168
169
  * @return The socket itself.
169
170
  */
170
171
  setNoDelay(noDelay?: boolean): this;
@@ -183,6 +184,8 @@ declare module 'net' {
183
184
  * * `TCP_KEEPCNT=10`
184
185
  * * `TCP_KEEPINTVL=1`
185
186
  * @since v0.1.92
187
+ * @param [enable=false]
188
+ * @param [initialDelay=0]
186
189
  * @return The socket itself.
187
190
  */
188
191
  setKeepAlive(enable?: boolean, initialDelay?: number): this;
@@ -280,7 +283,7 @@ declare module 'net' {
280
283
  *
281
284
  * See `writable.end()` for further details.
282
285
  * @since v0.1.90
283
- * @param encoding Only used when data is `string`.
286
+ * @param [encoding='utf8'] Only used when data is `string`.
284
287
  * @param callback Optional callback for when the socket is finished.
285
288
  * @return The socket itself.
286
289
  */
@@ -306,6 +309,7 @@ declare module 'net' {
306
309
  addListener(event: 'end', listener: () => void): this;
307
310
  addListener(event: 'error', listener: (err: Error) => void): this;
308
311
  addListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
312
+ addListener(event: 'ready', listener: () => void): this;
309
313
  addListener(event: 'timeout', listener: () => void): this;
310
314
  emit(event: string | symbol, ...args: any[]): boolean;
311
315
  emit(event: 'close', hadError: boolean): boolean;
@@ -315,6 +319,7 @@ declare module 'net' {
315
319
  emit(event: 'end'): boolean;
316
320
  emit(event: 'error', err: Error): boolean;
317
321
  emit(event: 'lookup', err: Error, address: string, family: string | number, host: string): boolean;
322
+ emit(event: 'ready'): boolean;
318
323
  emit(event: 'timeout'): boolean;
319
324
  on(event: string, listener: (...args: any[]) => void): this;
320
325
  on(event: 'close', listener: (hadError: boolean) => void): this;
@@ -324,6 +329,7 @@ declare module 'net' {
324
329
  on(event: 'end', listener: () => void): this;
325
330
  on(event: 'error', listener: (err: Error) => void): this;
326
331
  on(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
332
+ on(event: 'ready', listener: () => void): this;
327
333
  on(event: 'timeout', listener: () => void): this;
328
334
  once(event: string, listener: (...args: any[]) => void): this;
329
335
  once(event: 'close', listener: (hadError: boolean) => void): this;
@@ -333,6 +339,7 @@ declare module 'net' {
333
339
  once(event: 'end', listener: () => void): this;
334
340
  once(event: 'error', listener: (err: Error) => void): this;
335
341
  once(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
342
+ once(event: 'ready', listener: () => void): this;
336
343
  once(event: 'timeout', listener: () => void): this;
337
344
  prependListener(event: string, listener: (...args: any[]) => void): this;
338
345
  prependListener(event: 'close', listener: (hadError: boolean) => void): this;
@@ -342,6 +349,7 @@ declare module 'net' {
342
349
  prependListener(event: 'end', listener: () => void): this;
343
350
  prependListener(event: 'error', listener: (err: Error) => void): this;
344
351
  prependListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
352
+ prependListener(event: 'ready', listener: () => void): this;
345
353
  prependListener(event: 'timeout', listener: () => void): this;
346
354
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
347
355
  prependOnceListener(event: 'close', listener: (hadError: boolean) => void): this;
@@ -351,6 +359,7 @@ declare module 'net' {
351
359
  prependOnceListener(event: 'end', listener: () => void): this;
352
360
  prependOnceListener(event: 'error', listener: (err: Error) => void): this;
353
361
  prependOnceListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
362
+ prependOnceListener(event: 'ready', listener: () => void): this;
354
363
  prependOnceListener(event: 'timeout', listener: () => void): this;
355
364
  }
356
365
  interface ListenOptions extends Abortable {
@@ -558,7 +567,7 @@ declare module 'net' {
558
567
  * Adds a rule to block the given IP address.
559
568
  * @since v15.0.0
560
569
  * @param address An IPv4 or IPv6 address.
561
- * @param type Either `'ipv4'` or `'ipv6'`.
570
+ * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
562
571
  */
563
572
  addAddress(address: string, type?: IPVersion): void;
564
573
  addAddress(address: SocketAddress): void;
@@ -567,7 +576,7 @@ declare module 'net' {
567
576
  * @since v15.0.0
568
577
  * @param start The starting IPv4 or IPv6 address in the range.
569
578
  * @param end The ending IPv4 or IPv6 address in the range.
570
- * @param type Either `'ipv4'` or `'ipv6'`.
579
+ * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
571
580
  */
572
581
  addRange(start: string, end: string, type?: IPVersion): void;
573
582
  addRange(start: SocketAddress, end: SocketAddress): void;
@@ -576,7 +585,7 @@ declare module 'net' {
576
585
  * @since v15.0.0
577
586
  * @param net The network IPv4 or IPv6 address.
578
587
  * @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`.
579
- * @param type Either `'ipv4'` or `'ipv6'`.
588
+ * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
580
589
  */
581
590
  addSubnet(net: SocketAddress, prefix: number): void;
582
591
  addSubnet(net: string, prefix: number, type?: IPVersion): void;
@@ -599,7 +608,7 @@ declare module 'net' {
599
608
  * ```
600
609
  * @since v15.0.0
601
610
  * @param address The IP address to check
602
- * @param type Either `'ipv4'` or `'ipv6'`.
611
+ * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
603
612
  */
604
613
  check(address: SocketAddress): boolean;
605
614
  check(address: string, type?: IPVersion): boolean;
node/os.d.ts CHANGED
@@ -430,7 +430,7 @@ declare module 'os' {
430
430
  * Returns the scheduling priority for the process specified by `pid`. If `pid` is
431
431
  * not provided or is `0`, the priority of the current process is returned.
432
432
  * @since v10.10.0
433
- * @param pid The process ID to retrieve scheduling priority for.
433
+ * @param [pid=0] The process ID to retrieve scheduling priority for.
434
434
  */
435
435
  function getPriority(pid?: number): number;
436
436
  /**
@@ -444,7 +444,7 @@ declare module 'os' {
444
444
  * On Windows, setting priority to `PRIORITY_HIGHEST` requires elevated user
445
445
  * privileges. Otherwise the set priority will be silently reduced to`PRIORITY_HIGH`.
446
446
  * @since v10.10.0
447
- * @param pid The process ID to set scheduling priority for.
447
+ * @param [pid=0] The process ID to set scheduling priority for.
448
448
  * @param priority The scheduling priority to assign to the process.
449
449
  */
450
450
  function setPriority(priority: number): void;
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "16.4.8",
3
+ "version": "16.4.12",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -214,6 +214,11 @@
214
214
  "name": "NodeJS Contributors",
215
215
  "url": "https://github.com/NodeJS",
216
216
  "githubUsername": "NodeJS"
217
+ },
218
+ {
219
+ "name": "Linus Unnebäck",
220
+ "url": "https://github.com/LinusU",
221
+ "githubUsername": "LinusU"
217
222
  }
218
223
  ],
219
224
  "main": "",
@@ -232,6 +237,6 @@
232
237
  },
233
238
  "scripts": {},
234
239
  "dependencies": {},
235
- "typesPublisherContentHash": "09653edb27a1896712187332f491efb4bf99381b00b78f05e219f26450513dfb",
240
+ "typesPublisherContentHash": "72e2feda5b833f7d889625c0813da4a3ea14aeda595ba536a13d7f0418fb40ce",
236
241
  "typeScriptVersion": "3.6"
237
242
  }
node/process.d.ts CHANGED
@@ -579,7 +579,7 @@ declare module 'process' {
579
579
  * In `Worker` threads, this function stops the current thread rather
580
580
  * than the current process.
581
581
  * @since v0.1.13
582
- * @param code The exit code.
582
+ * @param [code=0] The exit code.
583
583
  */
584
584
  exit(code?: number): never;
585
585
  /**
@@ -935,7 +935,7 @@ declare module 'process' {
935
935
  * debugger. See `Signal Events`.
936
936
  * @since v0.0.6
937
937
  * @param pid A process ID
938
- * @param signal The signal to send, either as a string or number.
938
+ * @param [signal='SIGTERM'] The signal to send, either as a string or number.
939
939
  */
940
940
  kill(pid: number, signal?: string | number): true;
941
941
  /**