@types/node 20.1.2 → 20.1.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 +1 -1
- node/assert.d.ts +15 -0
- node/async_hooks.d.ts +3 -11
- node/child_process.d.ts +27 -0
- node/crypto.d.ts +1 -1
- node/dns/promises.d.ts +44 -0
- node/dns.d.ts +1 -0
- node/events.d.ts +49 -7
- node/fs.d.ts +36 -5
- node/package.json +2 -2
- node/readline/promises.d.ts +59 -59
- node/readline.d.ts +17 -144
- node/repl.d.ts +11 -11
- node/timers.d.ts +120 -6
- node/ts4.8/assert.d.ts +15 -0
- node/ts4.8/async_hooks.d.ts +3 -11
- node/ts4.8/child_process.d.ts +27 -0
- node/ts4.8/crypto.d.ts +1 -1
- node/ts4.8/dns/promises.d.ts +44 -0
- node/ts4.8/dns.d.ts +1 -0
- node/ts4.8/events.d.ts +49 -7
- node/ts4.8/fs.d.ts +36 -5
- node/ts4.8/readline/promises.d.ts +59 -59
- node/ts4.8/readline.d.ts +17 -144
- node/ts4.8/repl.d.ts +11 -11
- node/ts4.8/timers.d.ts +120 -6
node/readline.d.ts
CHANGED
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
declare module 'readline' {
|
|
36
36
|
import { Abortable, EventEmitter } from 'node:events';
|
|
37
37
|
import * as promises from 'node:readline/promises';
|
|
38
|
-
|
|
39
38
|
export { promises };
|
|
40
39
|
export interface Key {
|
|
41
40
|
sequence?: string | undefined;
|
|
@@ -74,7 +73,7 @@ declare module 'readline' {
|
|
|
74
73
|
* const showResults = debounce(() => {
|
|
75
74
|
* console.log(
|
|
76
75
|
* '\n',
|
|
77
|
-
* values.filter((val) => val.startsWith(rl.line)).join(' ')
|
|
76
|
+
* values.filter((val) => val.startsWith(rl.line)).join(' '),
|
|
78
77
|
* );
|
|
79
78
|
* }, 300);
|
|
80
79
|
* process.stdin.on('keypress', (c, k) => {
|
|
@@ -100,7 +99,7 @@ declare module 'readline' {
|
|
|
100
99
|
* > Instances of the `readline.Interface` class are constructed using the
|
|
101
100
|
* > `readline.createInterface()` method.
|
|
102
101
|
*
|
|
103
|
-
* @see https://nodejs.org/dist/latest-
|
|
102
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
|
|
104
103
|
*/
|
|
105
104
|
protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean);
|
|
106
105
|
/**
|
|
@@ -109,12 +108,12 @@ declare module 'readline' {
|
|
|
109
108
|
* > Instances of the `readline.Interface` class are constructed using the
|
|
110
109
|
* > `readline.createInterface()` method.
|
|
111
110
|
*
|
|
112
|
-
* @see https://nodejs.org/dist/latest-
|
|
111
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
|
|
113
112
|
*/
|
|
114
113
|
protected constructor(options: ReadLineOptions);
|
|
115
114
|
/**
|
|
116
115
|
* The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`.
|
|
117
|
-
* @since v15.3.0
|
|
116
|
+
* @since v15.3.0, v14.17.0
|
|
118
117
|
* @return the current prompt string
|
|
119
118
|
*/
|
|
120
119
|
getPrompt(): string;
|
|
@@ -124,13 +123,13 @@ declare module 'readline' {
|
|
|
124
123
|
*/
|
|
125
124
|
setPrompt(prompt: string): void;
|
|
126
125
|
/**
|
|
127
|
-
* The `rl.prompt()` method writes the `
|
|
126
|
+
* The `rl.prompt()` method writes the `Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new
|
|
128
127
|
* location at which to provide input.
|
|
129
128
|
*
|
|
130
129
|
* When called, `rl.prompt()` will resume the `input` stream if it has been
|
|
131
130
|
* paused.
|
|
132
131
|
*
|
|
133
|
-
* If the `
|
|
132
|
+
* If the `Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
|
|
134
133
|
* @since v0.1.98
|
|
135
134
|
* @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`.
|
|
136
135
|
*/
|
|
@@ -142,12 +141,14 @@ declare module 'readline' {
|
|
|
142
141
|
* When called, `rl.question()` will resume the `input` stream if it has been
|
|
143
142
|
* paused.
|
|
144
143
|
*
|
|
145
|
-
* If the `
|
|
144
|
+
* If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
|
|
146
145
|
*
|
|
147
146
|
* The `callback` function passed to `rl.question()` does not follow the typical
|
|
148
147
|
* pattern of accepting an `Error` object or `null` as the first argument.
|
|
149
148
|
* The `callback` is called with the provided answer as the only argument.
|
|
150
149
|
*
|
|
150
|
+
* An error will be thrown if calling `rl.question()` after `rl.close()`.
|
|
151
|
+
*
|
|
151
152
|
* Example usage:
|
|
152
153
|
*
|
|
153
154
|
* ```js
|
|
@@ -172,25 +173,6 @@ declare module 'readline' {
|
|
|
172
173
|
*
|
|
173
174
|
* setTimeout(() => ac.abort(), 10000);
|
|
174
175
|
* ```
|
|
175
|
-
*
|
|
176
|
-
* If this method is invoked as it's util.promisify()ed version, it returns a
|
|
177
|
-
* Promise that fulfills with the answer. If the question is canceled using
|
|
178
|
-
* an `AbortController` it will reject with an `AbortError`.
|
|
179
|
-
*
|
|
180
|
-
* ```js
|
|
181
|
-
* const util = require('util');
|
|
182
|
-
* const question = util.promisify(rl.question).bind(rl);
|
|
183
|
-
*
|
|
184
|
-
* async function questionExample() {
|
|
185
|
-
* try {
|
|
186
|
-
* const answer = await question('What is you favorite food? ');
|
|
187
|
-
* console.log(`Oh, so your favorite food is ${answer}`);
|
|
188
|
-
* } catch (err) {
|
|
189
|
-
* console.error('Question rejected', err);
|
|
190
|
-
* }
|
|
191
|
-
* }
|
|
192
|
-
* questionExample();
|
|
193
|
-
* ```
|
|
194
176
|
* @since v0.3.3
|
|
195
177
|
* @param query A statement or query to write to `output`, prepended to the prompt.
|
|
196
178
|
* @param callback A callback function that is invoked with the user's input in response to the `query`.
|
|
@@ -201,7 +183,7 @@ declare module 'readline' {
|
|
|
201
183
|
* The `rl.pause()` method pauses the `input` stream, allowing it to be resumed
|
|
202
184
|
* later if necessary.
|
|
203
185
|
*
|
|
204
|
-
* Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `
|
|
186
|
+
* Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `Interface` instance.
|
|
205
187
|
* @since v0.3.4
|
|
206
188
|
*/
|
|
207
189
|
pause(): this;
|
|
@@ -211,12 +193,12 @@ declare module 'readline' {
|
|
|
211
193
|
*/
|
|
212
194
|
resume(): this;
|
|
213
195
|
/**
|
|
214
|
-
* The `rl.close()` method closes the `
|
|
196
|
+
* The `rl.close()` method closes the `Interface` instance and
|
|
215
197
|
* relinquishes control over the `input` and `output` streams. When called,
|
|
216
198
|
* the `'close'` event will be emitted.
|
|
217
199
|
*
|
|
218
200
|
* Calling `rl.close()` does not immediately stop other events (including `'line'`)
|
|
219
|
-
* from being emitted by the `
|
|
201
|
+
* from being emitted by the `Interface` instance.
|
|
220
202
|
* @since v0.1.98
|
|
221
203
|
*/
|
|
222
204
|
close(): void;
|
|
@@ -231,7 +213,7 @@ declare module 'readline' {
|
|
|
231
213
|
* When called, `rl.write()` will resume the `input` stream if it has been
|
|
232
214
|
* paused.
|
|
233
215
|
*
|
|
234
|
-
* If the `
|
|
216
|
+
* If the `Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
|
|
235
217
|
*
|
|
236
218
|
* ```js
|
|
237
219
|
* rl.write('Delete this!');
|
|
@@ -351,10 +333,10 @@ declare module 'readline' {
|
|
|
351
333
|
* The `readline.createInterface()` method creates a new `readline.Interface`instance.
|
|
352
334
|
*
|
|
353
335
|
* ```js
|
|
354
|
-
* const readline = require('readline');
|
|
336
|
+
* const readline = require('node:readline');
|
|
355
337
|
* const rl = readline.createInterface({
|
|
356
338
|
* input: process.stdin,
|
|
357
|
-
* output: process.stdout
|
|
339
|
+
* output: process.stdout,
|
|
358
340
|
* });
|
|
359
341
|
* ```
|
|
360
342
|
*
|
|
@@ -373,14 +355,8 @@ declare module 'readline' {
|
|
|
373
355
|
* (`process.stdout` does this automatically when it is a TTY).
|
|
374
356
|
*
|
|
375
357
|
* When creating a `readline.Interface` using `stdin` as input, the program
|
|
376
|
-
* will not terminate until it receives
|
|
377
|
-
*
|
|
378
|
-
* Windows).
|
|
379
|
-
* If you want your application to exit without waiting for user input, you can `unref()` the standard input stream:
|
|
380
|
-
*
|
|
381
|
-
* ```js
|
|
382
|
-
* process.stdin.unref();
|
|
383
|
-
* ```
|
|
358
|
+
* will not terminate until it receives an [EOF character](https://en.wikipedia.org/wiki/End-of-file#EOF_character). To exit without
|
|
359
|
+
* waiting for user input, call `process.stdin.unref()`.
|
|
384
360
|
* @since v0.1.98
|
|
385
361
|
*/
|
|
386
362
|
export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
|
|
@@ -539,109 +515,6 @@ declare module 'readline' {
|
|
|
539
515
|
/**
|
|
540
516
|
* The `readline.moveCursor()` method moves the cursor _relative_ to its current
|
|
541
517
|
* position in a given `TTY` `stream`.
|
|
542
|
-
*
|
|
543
|
-
* ## Example: Tiny CLI
|
|
544
|
-
*
|
|
545
|
-
* The following example illustrates the use of `readline.Interface` class to
|
|
546
|
-
* implement a small command-line interface:
|
|
547
|
-
*
|
|
548
|
-
* ```js
|
|
549
|
-
* const readline = require('readline');
|
|
550
|
-
* const rl = readline.createInterface({
|
|
551
|
-
* input: process.stdin,
|
|
552
|
-
* output: process.stdout,
|
|
553
|
-
* prompt: 'OHAI> '
|
|
554
|
-
* });
|
|
555
|
-
*
|
|
556
|
-
* rl.prompt();
|
|
557
|
-
*
|
|
558
|
-
* rl.on('line', (line) => {
|
|
559
|
-
* switch (line.trim()) {
|
|
560
|
-
* case 'hello':
|
|
561
|
-
* console.log('world!');
|
|
562
|
-
* break;
|
|
563
|
-
* default:
|
|
564
|
-
* console.log(`Say what? I might have heard '${line.trim()}'`);
|
|
565
|
-
* break;
|
|
566
|
-
* }
|
|
567
|
-
* rl.prompt();
|
|
568
|
-
* }).on('close', () => {
|
|
569
|
-
* console.log('Have a great day!');
|
|
570
|
-
* process.exit(0);
|
|
571
|
-
* });
|
|
572
|
-
* ```
|
|
573
|
-
*
|
|
574
|
-
* ## Example: Read file stream line-by-Line
|
|
575
|
-
*
|
|
576
|
-
* A common use case for `readline` is to consume an input file one line at a
|
|
577
|
-
* time. The easiest way to do so is leveraging the `fs.ReadStream` API as
|
|
578
|
-
* well as a `for await...of` loop:
|
|
579
|
-
*
|
|
580
|
-
* ```js
|
|
581
|
-
* const fs = require('fs');
|
|
582
|
-
* const readline = require('readline');
|
|
583
|
-
*
|
|
584
|
-
* async function processLineByLine() {
|
|
585
|
-
* const fileStream = fs.createReadStream('input.txt');
|
|
586
|
-
*
|
|
587
|
-
* const rl = readline.createInterface({
|
|
588
|
-
* input: fileStream,
|
|
589
|
-
* crlfDelay: Infinity
|
|
590
|
-
* });
|
|
591
|
-
* // Note: we use the crlfDelay option to recognize all instances of CR LF
|
|
592
|
-
* // ('\r\n') in input.txt as a single line break.
|
|
593
|
-
*
|
|
594
|
-
* for await (const line of rl) {
|
|
595
|
-
* // Each line in input.txt will be successively available here as `line`.
|
|
596
|
-
* console.log(`Line from file: ${line}`);
|
|
597
|
-
* }
|
|
598
|
-
* }
|
|
599
|
-
*
|
|
600
|
-
* processLineByLine();
|
|
601
|
-
* ```
|
|
602
|
-
*
|
|
603
|
-
* Alternatively, one could use the `'line'` event:
|
|
604
|
-
*
|
|
605
|
-
* ```js
|
|
606
|
-
* const fs = require('fs');
|
|
607
|
-
* const readline = require('readline');
|
|
608
|
-
*
|
|
609
|
-
* const rl = readline.createInterface({
|
|
610
|
-
* input: fs.createReadStream('sample.txt'),
|
|
611
|
-
* crlfDelay: Infinity
|
|
612
|
-
* });
|
|
613
|
-
*
|
|
614
|
-
* rl.on('line', (line) => {
|
|
615
|
-
* console.log(`Line from file: ${line}`);
|
|
616
|
-
* });
|
|
617
|
-
* ```
|
|
618
|
-
*
|
|
619
|
-
* Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
|
|
620
|
-
*
|
|
621
|
-
* ```js
|
|
622
|
-
* const { once } = require('events');
|
|
623
|
-
* const { createReadStream } = require('fs');
|
|
624
|
-
* const { createInterface } = require('readline');
|
|
625
|
-
*
|
|
626
|
-
* (async function processLineByLine() {
|
|
627
|
-
* try {
|
|
628
|
-
* const rl = createInterface({
|
|
629
|
-
* input: createReadStream('big-file.txt'),
|
|
630
|
-
* crlfDelay: Infinity
|
|
631
|
-
* });
|
|
632
|
-
*
|
|
633
|
-
* rl.on('line', (line) => {
|
|
634
|
-
* // Process the line.
|
|
635
|
-
* });
|
|
636
|
-
*
|
|
637
|
-
* await once(rl, 'close');
|
|
638
|
-
*
|
|
639
|
-
* console.log('File processed.');
|
|
640
|
-
* } catch (err) {
|
|
641
|
-
* console.error(err);
|
|
642
|
-
* }
|
|
643
|
-
* })();
|
|
644
|
-
* ```
|
|
645
518
|
* @since v0.7.7
|
|
646
519
|
* @param callback Invoked once the operation completes.
|
|
647
520
|
* @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`.
|
node/repl.d.ts
CHANGED
|
@@ -41,8 +41,8 @@ declare module 'repl' {
|
|
|
41
41
|
* error with `repl.Recoverable` to indicate the input was incomplete and prompt for
|
|
42
42
|
* additional lines.
|
|
43
43
|
*
|
|
44
|
-
* @see https://nodejs.org/dist/latest-
|
|
45
|
-
* @see https://nodejs.org/dist/latest-
|
|
44
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_default_evaluation
|
|
45
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_custom_evaluation_functions
|
|
46
46
|
*/
|
|
47
47
|
eval?: REPLEval | undefined;
|
|
48
48
|
/**
|
|
@@ -74,13 +74,13 @@ declare module 'repl' {
|
|
|
74
74
|
* The function to invoke to format the output of each command before writing to `output`.
|
|
75
75
|
* Default: a wrapper for `util.inspect`.
|
|
76
76
|
*
|
|
77
|
-
* @see https://nodejs.org/dist/latest-
|
|
77
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_customizing_repl_output
|
|
78
78
|
*/
|
|
79
79
|
writer?: REPLWriter | undefined;
|
|
80
80
|
/**
|
|
81
81
|
* An optional function used for custom Tab auto completion.
|
|
82
82
|
*
|
|
83
|
-
* @see https://nodejs.org/dist/latest-
|
|
83
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#readline_use_of_the_completer_function
|
|
84
84
|
*/
|
|
85
85
|
completer?: Completer | AsyncCompleter | undefined;
|
|
86
86
|
/**
|
|
@@ -162,33 +162,33 @@ declare module 'repl' {
|
|
|
162
162
|
/**
|
|
163
163
|
* A value indicating whether the REPL is currently in "editor mode".
|
|
164
164
|
*
|
|
165
|
-
* @see https://nodejs.org/dist/latest-
|
|
165
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_commands_and_special_keys
|
|
166
166
|
*/
|
|
167
167
|
readonly editorMode: boolean;
|
|
168
168
|
/**
|
|
169
169
|
* A value indicating whether the `_` variable has been assigned.
|
|
170
170
|
*
|
|
171
|
-
* @see https://nodejs.org/dist/latest-
|
|
171
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
|
|
172
172
|
*/
|
|
173
173
|
readonly underscoreAssigned: boolean;
|
|
174
174
|
/**
|
|
175
175
|
* The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL).
|
|
176
176
|
*
|
|
177
|
-
* @see https://nodejs.org/dist/latest-
|
|
177
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
|
|
178
178
|
*/
|
|
179
179
|
readonly last: any;
|
|
180
180
|
/**
|
|
181
181
|
* A value indicating whether the `_error` variable has been assigned.
|
|
182
182
|
*
|
|
183
183
|
* @since v9.8.0
|
|
184
|
-
* @see https://nodejs.org/dist/latest-
|
|
184
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
|
|
185
185
|
*/
|
|
186
186
|
readonly underscoreErrAssigned: boolean;
|
|
187
187
|
/**
|
|
188
188
|
* The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL).
|
|
189
189
|
*
|
|
190
190
|
* @since v9.8.0
|
|
191
|
-
* @see https://nodejs.org/dist/latest-
|
|
191
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
|
|
192
192
|
*/
|
|
193
193
|
readonly lastError: any;
|
|
194
194
|
/**
|
|
@@ -240,7 +240,7 @@ declare module 'repl' {
|
|
|
240
240
|
*
|
|
241
241
|
* `REPLServer` cannot be subclassed due to implementation specifics in NodeJS.
|
|
242
242
|
*
|
|
243
|
-
* @see https://nodejs.org/dist/latest-
|
|
243
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_class_replserver
|
|
244
244
|
*/
|
|
245
245
|
private constructor();
|
|
246
246
|
/**
|
|
@@ -412,7 +412,7 @@ declare module 'repl' {
|
|
|
412
412
|
/**
|
|
413
413
|
* Indicates a recoverable error that a `REPLServer` can use to support multi-line input.
|
|
414
414
|
*
|
|
415
|
-
* @see https://nodejs.org/dist/latest-
|
|
415
|
+
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_recoverable_errors
|
|
416
416
|
*/
|
|
417
417
|
class Recoverable extends SyntaxError {
|
|
418
418
|
err: Error;
|
node/timers.d.ts
CHANGED
|
@@ -33,7 +33,35 @@ declare module 'timers' {
|
|
|
33
33
|
refresh(): this;
|
|
34
34
|
[Symbol.toPrimitive](): number;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* This object is created internally and is returned from `setImmediate()`. It
|
|
38
|
+
* can be passed to `clearImmediate()` in order to cancel the scheduled
|
|
39
|
+
* actions.
|
|
40
|
+
*
|
|
41
|
+
* By default, when an immediate is scheduled, the Node.js event loop will continue
|
|
42
|
+
* running as long as the immediate is active. The `Immediate` object returned by `setImmediate()` exports both `immediate.ref()` and `immediate.unref()`functions that can be used to
|
|
43
|
+
* control this default behavior.
|
|
44
|
+
*/
|
|
45
|
+
class Immediate implements RefCounted {
|
|
46
|
+
/**
|
|
47
|
+
* When called, requests that the Node.js event loop _not_ exit so long as the`Immediate` is active. Calling `immediate.ref()` multiple times will have no
|
|
48
|
+
* effect.
|
|
49
|
+
*
|
|
50
|
+
* By default, all `Immediate` objects are "ref'ed", making it normally unnecessary
|
|
51
|
+
* to call `immediate.ref()` unless `immediate.unref()` had been called previously.
|
|
52
|
+
* @since v9.7.0
|
|
53
|
+
* @return a reference to `immediate`
|
|
54
|
+
*/
|
|
55
|
+
ref(): this;
|
|
56
|
+
/**
|
|
57
|
+
* When called, the active `Immediate` object will not require the Node.js event
|
|
58
|
+
* loop to remain active. If there is no other activity keeping the event loop
|
|
59
|
+
* running, the process may exit before the `Immediate` object's callback is
|
|
60
|
+
* invoked. Calling `immediate.unref()` multiple times will have no effect.
|
|
61
|
+
* @since v9.7.0
|
|
62
|
+
* @return a reference to `immediate`
|
|
63
|
+
*/
|
|
64
|
+
unref(): this;
|
|
37
65
|
/**
|
|
38
66
|
* If true, the `Immediate` object will keep the Node.js event loop active.
|
|
39
67
|
* @since v11.0.0
|
|
@@ -41,7 +69,33 @@ declare module 'timers' {
|
|
|
41
69
|
hasRef(): boolean;
|
|
42
70
|
_onImmediate: Function; // to distinguish it from the Timeout class
|
|
43
71
|
}
|
|
44
|
-
|
|
72
|
+
/**
|
|
73
|
+
* This object is created internally and is returned from `setTimeout()` and `setInterval()`. It can be passed to either `clearTimeout()` or `clearInterval()` in order to cancel the
|
|
74
|
+
* scheduled actions.
|
|
75
|
+
*
|
|
76
|
+
* By default, when a timer is scheduled using either `setTimeout()` or `setInterval()`, the Node.js event loop will continue running as long as the
|
|
77
|
+
* timer is active. Each of the `Timeout` objects returned by these functions
|
|
78
|
+
* export both `timeout.ref()` and `timeout.unref()` functions that can be used to
|
|
79
|
+
* control this default behavior.
|
|
80
|
+
*/
|
|
81
|
+
class Timeout implements Timer {
|
|
82
|
+
/**
|
|
83
|
+
* When called, requests that the Node.js event loop _not_ exit so long as the`Timeout` is active. Calling `timeout.ref()` multiple times will have no effect.
|
|
84
|
+
*
|
|
85
|
+
* By default, all `Timeout` objects are "ref'ed", making it normally unnecessary
|
|
86
|
+
* to call `timeout.ref()` unless `timeout.unref()` had been called previously.
|
|
87
|
+
* @since v0.9.1
|
|
88
|
+
* @return a reference to `timeout`
|
|
89
|
+
*/
|
|
90
|
+
ref(): this;
|
|
91
|
+
/**
|
|
92
|
+
* When called, the active `Timeout` object will not require the Node.js event loop
|
|
93
|
+
* to remain active. If there is no other activity keeping the event loop running,
|
|
94
|
+
* the process may exit before the `Timeout` object's callback is invoked. Calling`timeout.unref()` multiple times will have no effect.
|
|
95
|
+
* @since v0.9.1
|
|
96
|
+
* @return a reference to `timeout`
|
|
97
|
+
*/
|
|
98
|
+
unref(): this;
|
|
45
99
|
/**
|
|
46
100
|
* If true, the `Timeout` object will keep the Node.js event loop active.
|
|
47
101
|
* @since v11.0.0
|
|
@@ -63,11 +117,23 @@ declare module 'timers' {
|
|
|
63
117
|
}
|
|
64
118
|
}
|
|
65
119
|
/**
|
|
66
|
-
* Schedules execution of a one-time `callback` after `delay` milliseconds.
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
120
|
+
* Schedules execution of a one-time `callback` after `delay` milliseconds.
|
|
121
|
+
*
|
|
122
|
+
* The `callback` will likely not be invoked in precisely `delay` milliseconds.
|
|
123
|
+
* Node.js makes no guarantees about the exact timing of when callbacks will fire,
|
|
124
|
+
* nor of their ordering. The callback will be called as close as possible to the
|
|
125
|
+
* time specified.
|
|
126
|
+
*
|
|
127
|
+
* When `delay` is larger than `2147483647` or less than `1`, the `delay`will be set to `1`. Non-integer delays are truncated to an integer.
|
|
128
|
+
*
|
|
129
|
+
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
130
|
+
*
|
|
131
|
+
* This method has a custom variant for promises that is available using `timersPromises.setTimeout()`.
|
|
70
132
|
* @since v0.0.1
|
|
133
|
+
* @param callback The function to call when the timer elapses.
|
|
134
|
+
* @param [delay=1] The number of milliseconds to wait before calling the `callback`.
|
|
135
|
+
* @param args Optional arguments to pass when the `callback` is called.
|
|
136
|
+
* @return for use with {@link clearTimeout}
|
|
71
137
|
*/
|
|
72
138
|
function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
|
|
73
139
|
// util.promisify no rest args compability
|
|
@@ -76,7 +142,27 @@ declare module 'timers' {
|
|
|
76
142
|
namespace setTimeout {
|
|
77
143
|
const __promisify__: typeof setTimeoutPromise;
|
|
78
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Cancels a `Timeout` object created by `setTimeout()`.
|
|
147
|
+
* @since v0.0.1
|
|
148
|
+
* @param timeout A `Timeout` object as returned by {@link setTimeout} or the `primitive` of the `Timeout` object as a string or a number.
|
|
149
|
+
*/
|
|
79
150
|
function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
|
|
151
|
+
/**
|
|
152
|
+
* Schedules repeated execution of `callback` every `delay` milliseconds.
|
|
153
|
+
*
|
|
154
|
+
* When `delay` is larger than `2147483647` or less than `1`, the `delay` will be
|
|
155
|
+
* set to `1`. Non-integer delays are truncated to an integer.
|
|
156
|
+
*
|
|
157
|
+
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
158
|
+
*
|
|
159
|
+
* This method has a custom variant for promises that is available using `timersPromises.setInterval()`.
|
|
160
|
+
* @since v0.0.1
|
|
161
|
+
* @param callback The function to call when the timer elapses.
|
|
162
|
+
* @param [delay=1] The number of milliseconds to wait before calling the `callback`.
|
|
163
|
+
* @param args Optional arguments to pass when the `callback` is called.
|
|
164
|
+
* @return for use with {@link clearInterval}
|
|
165
|
+
*/
|
|
80
166
|
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
|
|
81
167
|
// util.promisify no rest args compability
|
|
82
168
|
// tslint:disable-next-line void-return
|
|
@@ -84,7 +170,30 @@ declare module 'timers' {
|
|
|
84
170
|
namespace setInterval {
|
|
85
171
|
const __promisify__: typeof setIntervalPromise;
|
|
86
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Cancels a `Timeout` object created by `setInterval()`.
|
|
175
|
+
* @since v0.0.1
|
|
176
|
+
* @param timeout A `Timeout` object as returned by {@link setInterval} or the `primitive` of the `Timeout` object as a string or a number.
|
|
177
|
+
*/
|
|
87
178
|
function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
|
|
179
|
+
/**
|
|
180
|
+
* Schedules the "immediate" execution of the `callback` after I/O events'
|
|
181
|
+
* callbacks.
|
|
182
|
+
*
|
|
183
|
+
* When multiple calls to `setImmediate()` are made, the `callback` functions are
|
|
184
|
+
* queued for execution in the order in which they are created. The entire callback
|
|
185
|
+
* queue is processed every event loop iteration. If an immediate timer is queued
|
|
186
|
+
* from inside an executing callback, that timer will not be triggered until the
|
|
187
|
+
* next event loop iteration.
|
|
188
|
+
*
|
|
189
|
+
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
190
|
+
*
|
|
191
|
+
* This method has a custom variant for promises that is available using `timersPromises.setImmediate()`.
|
|
192
|
+
* @since v0.9.1
|
|
193
|
+
* @param callback The function to call at the end of this turn of the Node.js `Event Loop`
|
|
194
|
+
* @param args Optional arguments to pass when the `callback` is called.
|
|
195
|
+
* @return for use with {@link clearImmediate}
|
|
196
|
+
*/
|
|
88
197
|
function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
|
|
89
198
|
// util.promisify no rest args compability
|
|
90
199
|
// tslint:disable-next-line void-return
|
|
@@ -92,6 +201,11 @@ declare module 'timers' {
|
|
|
92
201
|
namespace setImmediate {
|
|
93
202
|
const __promisify__: typeof setImmediatePromise;
|
|
94
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Cancels an `Immediate` object created by `setImmediate()`.
|
|
206
|
+
* @since v0.9.1
|
|
207
|
+
* @param immediate An `Immediate` object as returned by {@link setImmediate}.
|
|
208
|
+
*/
|
|
95
209
|
function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
|
|
96
210
|
function queueMicrotask(callback: () => void): void;
|
|
97
211
|
}
|
node/ts4.8/assert.d.ts
CHANGED
|
@@ -15,10 +15,25 @@ declare module 'assert' {
|
|
|
15
15
|
* Indicates the failure of an assertion. All errors thrown by the `node:assert`module will be instances of the `AssertionError` class.
|
|
16
16
|
*/
|
|
17
17
|
class AssertionError extends Error {
|
|
18
|
+
/**
|
|
19
|
+
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
|
|
20
|
+
*/
|
|
18
21
|
actual: unknown;
|
|
22
|
+
/**
|
|
23
|
+
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
|
|
24
|
+
*/
|
|
19
25
|
expected: unknown;
|
|
26
|
+
/**
|
|
27
|
+
* Set to the passed in operator value.
|
|
28
|
+
*/
|
|
20
29
|
operator: string;
|
|
30
|
+
/**
|
|
31
|
+
* Indicates if the message was auto-generated (`true`) or not.
|
|
32
|
+
*/
|
|
21
33
|
generatedMessage: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
|
|
36
|
+
*/
|
|
22
37
|
code: 'ERR_ASSERTION';
|
|
23
38
|
constructor(options?: {
|
|
24
39
|
/** If provided, the error message is set to this value. */
|
node/ts4.8/async_hooks.d.ts
CHANGED
|
@@ -274,19 +274,13 @@ declare module 'async_hooks' {
|
|
|
274
274
|
* @param fn The function to bind to the current execution context.
|
|
275
275
|
* @param type An optional name to associate with the underlying `AsyncResource`.
|
|
276
276
|
*/
|
|
277
|
-
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
|
|
278
|
-
fn: Func,
|
|
279
|
-
type?: string,
|
|
280
|
-
thisArg?: ThisArg
|
|
281
|
-
): Func;
|
|
277
|
+
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(fn: Func, type?: string, thisArg?: ThisArg): Func;
|
|
282
278
|
/**
|
|
283
279
|
* Binds the given function to execute to this `AsyncResource`'s scope.
|
|
284
280
|
* @since v14.8.0, v12.19.0
|
|
285
281
|
* @param fn The function to bind to the current `AsyncResource`.
|
|
286
282
|
*/
|
|
287
|
-
bind<Func extends (...args: any[]) => any>(
|
|
288
|
-
fn: Func
|
|
289
|
-
): Func;
|
|
283
|
+
bind<Func extends (...args: any[]) => any>(fn: Func): Func;
|
|
290
284
|
/**
|
|
291
285
|
* Call the provided function with the provided arguments in the execution context
|
|
292
286
|
* of the async resource. This will establish the context, trigger the AsyncHooks
|
|
@@ -372,9 +366,7 @@ declare module 'async_hooks' {
|
|
|
372
366
|
* @param fn The function to bind to the current execution context.
|
|
373
367
|
* @return A new function that calls `fn` within the captured execution context.
|
|
374
368
|
*/
|
|
375
|
-
static bind<Func extends (...args: any[]) => any>(
|
|
376
|
-
fn: Func
|
|
377
|
-
): Func;
|
|
369
|
+
static bind<Func extends (...args: any[]) => any>(fn: Func): Func;
|
|
378
370
|
/**
|
|
379
371
|
* Captures the current execution context and returns a function that accepts a
|
|
380
372
|
* function as an argument. Whenever the returned function is called, it
|
node/ts4.8/child_process.d.ts
CHANGED
|
@@ -630,6 +630,15 @@ declare module 'child_process' {
|
|
|
630
630
|
}
|
|
631
631
|
interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
|
|
632
632
|
argv0?: string | undefined;
|
|
633
|
+
/**
|
|
634
|
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
|
635
|
+
* If passed as an array, the first element is used for `stdin`, the second for
|
|
636
|
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
|
637
|
+
* specify the `stdio` behavior beyond the standard streams. See
|
|
638
|
+
* {@link ChildProcess.stdio} for more information.
|
|
639
|
+
*
|
|
640
|
+
* @default 'pipe'
|
|
641
|
+
*/
|
|
633
642
|
stdio?: StdioOptions | undefined;
|
|
634
643
|
shell?: boolean | string | undefined;
|
|
635
644
|
windowsVerbatimArguments?: boolean | undefined;
|
|
@@ -1191,6 +1200,15 @@ declare module 'child_process' {
|
|
|
1191
1200
|
execPath?: string | undefined;
|
|
1192
1201
|
execArgv?: string[] | undefined;
|
|
1193
1202
|
silent?: boolean | undefined;
|
|
1203
|
+
/**
|
|
1204
|
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
|
1205
|
+
* If passed as an array, the first element is used for `stdin`, the second for
|
|
1206
|
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
|
1207
|
+
* specify the `stdio` behavior beyond the standard streams. See
|
|
1208
|
+
* {@link ChildProcess.stdio} for more information.
|
|
1209
|
+
*
|
|
1210
|
+
* @default 'pipe'
|
|
1211
|
+
*/
|
|
1194
1212
|
stdio?: StdioOptions | undefined;
|
|
1195
1213
|
detached?: boolean | undefined;
|
|
1196
1214
|
windowsVerbatimArguments?: boolean | undefined;
|
|
@@ -1291,6 +1309,15 @@ declare module 'child_process' {
|
|
|
1291
1309
|
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
|
|
1292
1310
|
interface CommonExecOptions extends CommonOptions {
|
|
1293
1311
|
input?: string | NodeJS.ArrayBufferView | undefined;
|
|
1312
|
+
/**
|
|
1313
|
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
|
1314
|
+
* If passed as an array, the first element is used for `stdin`, the second for
|
|
1315
|
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
|
1316
|
+
* specify the `stdio` behavior beyond the standard streams. See
|
|
1317
|
+
* {@link ChildProcess.stdio} for more information.
|
|
1318
|
+
*
|
|
1319
|
+
* @default 'pipe'
|
|
1320
|
+
*/
|
|
1294
1321
|
stdio?: StdioOptions | undefined;
|
|
1295
1322
|
killSignal?: NodeJS.Signals | number | undefined;
|
|
1296
1323
|
maxBuffer?: number | undefined;
|
node/ts4.8/crypto.d.ts
CHANGED
|
@@ -96,7 +96,7 @@ declare module 'crypto' {
|
|
|
96
96
|
verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
|
|
97
97
|
}
|
|
98
98
|
namespace constants {
|
|
99
|
-
// https://nodejs.org/dist/latest-
|
|
99
|
+
// https://nodejs.org/dist/latest-v20.x/docs/api/crypto.html#crypto-constants
|
|
100
100
|
const OPENSSL_VERSION_NUMBER: number;
|
|
101
101
|
/** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */
|
|
102
102
|
const SSL_OP_ALL: number;
|