@types/node 20.4.2 → 20.4.4

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/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 12 Jul 2023 23:02:41 GMT
11
+ * Last updated: Sat, 22 Jul 2023 12:32:49 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/events.d.ts CHANGED
@@ -294,6 +294,35 @@ declare module 'events' {
294
294
  * @since v15.2.0, v14.17.0
295
295
  */
296
296
  static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
297
+ /**
298
+ * Returns the currently set max amount of listeners.
299
+ *
300
+ * For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on
301
+ * the emitter.
302
+ *
303
+ * For `EventTarget`s this is the only way to get the max event listeners for the
304
+ * event target. If the number of event handlers on a single EventTarget exceeds
305
+ * the max set, the EventTarget will print a warning.
306
+ *
307
+ * ```js
308
+ * import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
309
+ *
310
+ * {
311
+ * const ee = new EventEmitter();
312
+ * console.log(getMaxListeners(ee)); // 10
313
+ * setMaxListeners(11, ee);
314
+ * console.log(getMaxListeners(ee)); // 11
315
+ * }
316
+ * {
317
+ * const et = new EventTarget();
318
+ * console.log(getMaxListeners(et)); // 10
319
+ * setMaxListeners(11, et);
320
+ * console.log(getMaxListeners(et)); // 11
321
+ * }
322
+ * ```
323
+ * @since v19.9.0
324
+ */
325
+ static getMaxListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter): number;
297
326
  /**
298
327
  * ```js
299
328
  * import { setMaxListeners, EventEmitter } from 'node:events';
node/fs/promises.d.ts CHANGED
@@ -82,6 +82,13 @@ declare module 'fs/promises' {
82
82
  emitClose?: boolean | undefined;
83
83
  start?: number | undefined;
84
84
  }
85
+ interface ReadableWebStreamOptions {
86
+ /**
87
+ * Whether to open a normal or a `'bytes'` stream.
88
+ * @since v20.0.0
89
+ */
90
+ type?: 'bytes' | undefined;
91
+ }
85
92
  // TODO: Add `EventEmitter` close
86
93
  interface FileHandle {
87
94
  /**
@@ -240,7 +247,7 @@ declare module 'fs/promises' {
240
247
  * @since v17.0.0
241
248
  * @experimental
242
249
  */
243
- readableWebStream(): ReadableStream;
250
+ readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
244
251
  /**
245
252
  * Asynchronously reads the entire contents of a file.
246
253
  *
node/http2.d.ts CHANGED
@@ -128,7 +128,7 @@ declare module 'http2' {
128
128
  * value will be `undefined` after the `Http2Stream` instance is destroyed.
129
129
  * @since v8.4.0
130
130
  */
131
- readonly session: Http2Session;
131
+ readonly session: Http2Session | undefined;
132
132
  /**
133
133
  * Provides miscellaneous information about the current state of the`Http2Stream`.
134
134
  *
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "20.4.2",
3
+ "version": "20.4.4",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -232,6 +232,6 @@
232
232
  },
233
233
  "scripts": {},
234
234
  "dependencies": {},
235
- "typesPublisherContentHash": "8ccebbf79ef4c9ade9cde2b505492190d140170bf4372bb3fe1ebd36e9344eac",
235
+ "typesPublisherContentHash": "3855eba1e7ca267925b74e739e5e432e9cc50d4b0e66091d7500d97ce36348d8",
236
236
  "typeScriptVersion": "4.3"
237
237
  }
node/ts4.8/events.d.ts CHANGED
@@ -294,6 +294,35 @@ declare module 'events' {
294
294
  * @since v15.2.0, v14.17.0
295
295
  */
296
296
  static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
297
+ /**
298
+ * Returns the currently set max amount of listeners.
299
+ *
300
+ * For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on
301
+ * the emitter.
302
+ *
303
+ * For `EventTarget`s this is the only way to get the max event listeners for the
304
+ * event target. If the number of event handlers on a single EventTarget exceeds
305
+ * the max set, the EventTarget will print a warning.
306
+ *
307
+ * ```js
308
+ * import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
309
+ *
310
+ * {
311
+ * const ee = new EventEmitter();
312
+ * console.log(getMaxListeners(ee)); // 10
313
+ * setMaxListeners(11, ee);
314
+ * console.log(getMaxListeners(ee)); // 11
315
+ * }
316
+ * {
317
+ * const et = new EventTarget();
318
+ * console.log(getMaxListeners(et)); // 10
319
+ * setMaxListeners(11, et);
320
+ * console.log(getMaxListeners(et)); // 11
321
+ * }
322
+ * ```
323
+ * @since v19.9.0
324
+ */
325
+ static getMaxListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter): number;
297
326
  /**
298
327
  * ```js
299
328
  * import { setMaxListeners, EventEmitter } from 'node:events';
@@ -82,6 +82,13 @@ declare module 'fs/promises' {
82
82
  emitClose?: boolean | undefined;
83
83
  start?: number | undefined;
84
84
  }
85
+ interface ReadableWebStreamOptions {
86
+ /**
87
+ * Whether to open a normal or a `'bytes'` stream.
88
+ * @since v20.0.0
89
+ */
90
+ type?: 'bytes' | undefined;
91
+ }
85
92
  // TODO: Add `EventEmitter` close
86
93
  interface FileHandle {
87
94
  /**
@@ -240,7 +247,7 @@ declare module 'fs/promises' {
240
247
  * @since v17.0.0
241
248
  * @experimental
242
249
  */
243
- readableWebStream(): ReadableStream;
250
+ readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
244
251
  /**
245
252
  * Asynchronously reads the entire contents of a file.
246
253
  *
@@ -720,7 +727,8 @@ declare module 'fs/promises' {
720
727
  * autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not
721
728
  * exist, `'file'` will be used. Windows junction points require the destination
722
729
  * path to be absolute. When using `'junction'`, the `target` argument will
723
- * automatically be normalized to absolute path.
730
+ * automatically be normalized to absolute path. Junction points on NTFS volumes
731
+ * can only point to directories.
724
732
  * @since v10.0.0
725
733
  * @param [type='null']
726
734
  * @return Fulfills with `undefined` upon success.
node/ts4.8/http2.d.ts CHANGED
@@ -128,7 +128,7 @@ declare module 'http2' {
128
128
  * value will be `undefined` after the `Http2Stream` instance is destroyed.
129
129
  * @since v8.4.0
130
130
  */
131
- readonly session: Http2Session;
131
+ readonly session: Http2Session | undefined;
132
132
  /**
133
133
  * Provides miscellaneous information about the current state of the`Http2Stream`.
134
134
  *
node/ts4.8/url.d.ts CHANGED
@@ -394,6 +394,20 @@ declare module 'url' {
394
394
  * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
395
395
  */
396
396
  static revokeObjectURL(objectUrl: string): void;
397
+ /**
398
+ * Checks if an `input` relative to the `base` can be parsed to a `URL`.
399
+ *
400
+ * ```js
401
+ * const isValid = URL.canParse('/foo', 'https://example.org/'); // true
402
+ *
403
+ * const isNotValid = URL.canParse('/foo'); // false
404
+ * ```
405
+ * @since v19.9.0
406
+ * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is
407
+ * `converted to a string` first.
408
+ * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
409
+ */
410
+ static canParse(input: string, base?: string): boolean;
397
411
  constructor(input: string, base?: string | URL);
398
412
  /**
399
413
  * Gets and sets the fragment portion of the URL.
node/url.d.ts CHANGED
@@ -394,6 +394,20 @@ declare module 'url' {
394
394
  * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
395
395
  */
396
396
  static revokeObjectURL(objectUrl: string): void;
397
+ /**
398
+ * Checks if an `input` relative to the `base` can be parsed to a `URL`.
399
+ *
400
+ * ```js
401
+ * const isValid = URL.canParse('/foo', 'https://example.org/'); // true
402
+ *
403
+ * const isNotValid = URL.canParse('/foo'); // false
404
+ * ```
405
+ * @since v19.9.0
406
+ * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is
407
+ * `converted to a string` first.
408
+ * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
409
+ */
410
+ static canParse(input: string, base?: string): boolean;
397
411
  constructor(input: string, base?: string | URL);
398
412
  /**
399
413
  * Gets and sets the fragment portion of the URL.