@types/node 20.17.5 → 20.17.7

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 v20.17/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v20.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 31 Oct 2024 18:02:52 GMT
11
+ * Last updated: Sat, 23 Nov 2024 04:36:04 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node v20.17/module.d.ts CHANGED
@@ -48,7 +48,7 @@ declare module "module" {
48
48
  * @since v13.7.0, v12.17.0
49
49
  * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
50
50
  */
51
- function findSourceMap(path: string, error?: Error): SourceMap;
51
+ function findSourceMap(path: string, error?: Error): SourceMap | undefined;
52
52
  interface SourceMapPayload {
53
53
  file: string;
54
54
  version: number;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "20.17.5",
3
+ "version": "20.17.7",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -220,6 +220,6 @@
220
220
  "undici-types": "~6.19.2"
221
221
  },
222
222
  "peerDependencies": {},
223
- "typesPublisherContentHash": "e138c8aac91c9e2a9ee62ceedbbaedf2bfd67e9d9745cbdc3ac2bc7d52a41261",
224
- "typeScriptVersion": "4.8"
223
+ "typesPublisherContentHash": "670bce0ad1c8e9b9c8b571d14b1f57148845474965bc3223dc2d7da273ce1855",
224
+ "typeScriptVersion": "4.9"
225
225
  }
@@ -3,8 +3,13 @@
3
3
  * @experimental
4
4
  */
5
5
  declare module "readline/promises" {
6
- import { AsyncCompleter, Completer, Direction, Interface as _Interface, ReadLineOptions } from "node:readline";
7
6
  import { Abortable } from "node:events";
7
+ import {
8
+ CompleterResult,
9
+ Direction,
10
+ Interface as _Interface,
11
+ ReadLineOptions as _ReadLineOptions,
12
+ } from "node:readline";
8
13
  /**
9
14
  * Instances of the `readlinePromises.Interface` class are constructed using the `readlinePromises.createInterface()` method. Every instance is associated with a
10
15
  * single `input` `Readable` stream and a single `output` `Writable` stream.
@@ -111,6 +116,13 @@ declare module "readline/promises" {
111
116
  */
112
117
  rollback(): this;
113
118
  }
119
+ type Completer = (line: string) => CompleterResult | Promise<CompleterResult>;
120
+ interface ReadLineOptions extends Omit<_ReadLineOptions, "completer"> {
121
+ /**
122
+ * An optional function used for Tab autocompletion.
123
+ */
124
+ completer?: Completer | undefined;
125
+ }
114
126
  /**
115
127
  * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance.
116
128
  *
@@ -140,7 +152,7 @@ declare module "readline/promises" {
140
152
  function createInterface(
141
153
  input: NodeJS.ReadableStream,
142
154
  output?: NodeJS.WritableStream,
143
- completer?: Completer | AsyncCompleter,
155
+ completer?: Completer,
144
156
  terminal?: boolean,
145
157
  ): Interface;
146
158
  function createInterface(options: ReadLineOptions): Interface;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/latest-v20.x/api/stream.html#readable-streams) stream
3
- * (such as [`process.stdin`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstdin)) one line at a time.
2
+ * The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/stream.html#readable-streams) stream
3
+ * (such as [`process.stdin`](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/process.html#processstdin)) one line at a time.
4
4
  *
5
5
  * To use the promise-based APIs:
6
6
  *
@@ -46,7 +46,7 @@ declare module "readline" {
46
46
  }
47
47
  /**
48
48
  * Instances of the `readline.Interface` class are constructed using the `readline.createInterface()` method. Every instance is associated with a
49
- * single `input` [Readable](https://nodejs.org/docs/latest-v20.x/api/stream.html#readable-streams) stream and a single `output` [Writable](https://nodejs.org/docs/latest-v20.x/api/stream.html#writable-streams) stream.
49
+ * single `input` [Readable](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/stream.html#readable-streams) stream and a single `output` [Writable](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/stream.html#writable-streams) stream.
50
50
  * The `output` stream is used to print prompts for user input that arrives on,
51
51
  * and is read from, the `input` stream.
52
52
  * @since v0.1.104
@@ -100,7 +100,7 @@ declare module "readline" {
100
100
  * > Instances of the `readline.Interface` class are constructed using the
101
101
  * > `readline.createInterface()` method.
102
102
  *
103
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
103
+ * @see https://nodejs.org/docs/latest-v20.x/api/readline.html#class-interfaceconstructor
104
104
  */
105
105
  protected constructor(
106
106
  input: NodeJS.ReadableStream,
@@ -114,7 +114,7 @@ declare module "readline" {
114
114
  * > Instances of the `readline.Interface` class are constructed using the
115
115
  * > `readline.createInterface()` method.
116
116
  *
117
- * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
117
+ * @see https://nodejs.org/docs/latest-v20.x/api/readline.html#class-interfaceconstructor
118
118
  */
119
119
  protected constructor(options: ReadLineOptions);
120
120
  /**
@@ -314,29 +314,78 @@ declare module "readline" {
314
314
  ) => void;
315
315
  export type CompleterResult = [string[], string];
316
316
  export interface ReadLineOptions {
317
+ /**
318
+ * The [`Readable`](https://nodejs.org/docs/latest-v20.x/api/stream.html#readable-streams) stream to listen to
319
+ */
317
320
  input: NodeJS.ReadableStream;
321
+ /**
322
+ * The [`Writable`](https://nodejs.org/docs/latest-v20.x/api/stream.html#writable-streams) stream to write readline data to.
323
+ */
318
324
  output?: NodeJS.WritableStream | undefined;
325
+ /**
326
+ * An optional function used for Tab autocompletion.
327
+ */
319
328
  completer?: Completer | AsyncCompleter | undefined;
329
+ /**
330
+ * `true` if the `input` and `output` streams should be treated like a TTY,
331
+ * and have ANSI/VT100 escape codes written to it.
332
+ * Default: checking `isTTY` on the `output` stream upon instantiation.
333
+ */
320
334
  terminal?: boolean | undefined;
321
335
  /**
322
- * Initial list of history lines. This option makes sense
323
- * only if `terminal` is set to `true` by the user or by an internal `output`
324
- * check, otherwise the history caching mechanism is not initialized at all.
336
+ * Initial list of history lines.
337
+ * This option makes sense only if `terminal` is set to `true` by the user or by an internal `output` check,
338
+ * otherwise the history caching mechanism is not initialized at all.
325
339
  * @default []
326
340
  */
327
341
  history?: string[] | undefined;
342
+ /**
343
+ * Maximum number of history lines retained.
344
+ * To disable the history set this value to `0`.
345
+ * This option makes sense only if `terminal` is set to `true` by the user or by an internal `output` check,
346
+ * otherwise the history caching mechanism is not initialized at all.
347
+ * @default 30
348
+ */
328
349
  historySize?: number | undefined;
329
- prompt?: string | undefined;
330
- crlfDelay?: number | undefined;
331
350
  /**
332
- * If `true`, when a new input line added
333
- * to the history list duplicates an older one, this removes the older line
334
- * from the list.
351
+ * If `true`, when a new input line added to the history list duplicates an older one,
352
+ * this removes the older line from the list.
335
353
  * @default false
336
354
  */
337
355
  removeHistoryDuplicates?: boolean | undefined;
356
+ /**
357
+ * The prompt string to use.
358
+ * @default "> "
359
+ */
360
+ prompt?: string | undefined;
361
+ /**
362
+ * If the delay between `\r` and `\n` exceeds `crlfDelay` milliseconds,
363
+ * both `\r` and `\n` will be treated as separate end-of-line input.
364
+ * `crlfDelay` will be coerced to a number no less than `100`.
365
+ * It can be set to `Infinity`, in which case
366
+ * `\r` followed by `\n` will always be considered a single newline
367
+ * (which may be reasonable for [reading files](https://nodejs.org/docs/latest-v20.x/api/readline.html#example-read-file-stream-line-by-line) with `\r\n` line delimiter).
368
+ * @default 100
369
+ */
370
+ crlfDelay?: number | undefined;
371
+ /**
372
+ * The duration `readline` will wait for a character
373
+ * (when reading an ambiguous key sequence in milliseconds
374
+ * one that can both form a complete key sequence using the input read so far
375
+ * and can take additional input to complete a longer key sequence).
376
+ * @default 500
377
+ */
338
378
  escapeCodeTimeout?: number | undefined;
379
+ /**
380
+ * The number of spaces a tab is equal to (minimum 1).
381
+ * @default 8
382
+ */
339
383
  tabSize?: number | undefined;
384
+ /**
385
+ * Allows closing the interface using an AbortSignal.
386
+ * Aborting the signal will internally call `close` on the interface.
387
+ */
388
+ signal?: AbortSignal | undefined;
340
389
  }
341
390
  /**
342
391
  * The `readline.createInterface()` method creates a new `readline.Interface` instance.
@@ -503,7 +552,7 @@ declare module "readline" {
503
552
  cols: number;
504
553
  }
505
554
  /**
506
- * The `readline.clearLine()` method clears current line of given [TTY](https://nodejs.org/docs/latest-v20.x/api/tty.html) stream
555
+ * The `readline.clearLine()` method clears current line of given [TTY](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/tty.html) stream
507
556
  * in a specified direction identified by `dir`.
508
557
  * @since v0.7.7
509
558
  * @param callback Invoked once the operation completes.
@@ -511,7 +560,7 @@ declare module "readline" {
511
560
  */
512
561
  export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
513
562
  /**
514
- * The `readline.clearScreenDown()` method clears the given [TTY](https://nodejs.org/docs/latest-v20.x/api/tty.html) stream from
563
+ * The `readline.clearScreenDown()` method clears the given [TTY](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/tty.html) stream from
515
564
  * the current position of the cursor down.
516
565
  * @since v0.7.7
517
566
  * @param callback Invoked once the operation completes.
@@ -520,7 +569,7 @@ declare module "readline" {
520
569
  export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
521
570
  /**
522
571
  * The `readline.cursorTo()` method moves cursor to the specified position in a
523
- * given [TTY](https://nodejs.org/docs/latest-v20.x/api/tty.html) `stream`.
572
+ * given [TTY](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/tty.html) `stream`.
524
573
  * @since v0.7.7
525
574
  * @param callback Invoked once the operation completes.
526
575
  * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
@@ -528,7 +577,7 @@ declare module "readline" {
528
577
  export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
529
578
  /**
530
579
  * The `readline.moveCursor()` method moves the cursor _relative_ to its current
531
- * position in a given [TTY](https://nodejs.org/docs/latest-v20.x/api/tty.html) `stream`.
580
+ * position in a given [TTY](https://nodejs.org/docs/https://nodejs.org/docs/latest-v20.x/api/tty.html) `stream`.
532
581
  * @since v0.7.7
533
582
  * @param callback Invoked once the operation completes.
534
583
  * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.