@types/node 14.18.7 → 15.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. {node v14.18 → node}/LICENSE +0 -0
  2. node/README.md +16 -0
  3. node/assert/strict.d.ts +4 -0
  4. node v14.18/assert.d.ts → node/assert.d.ts +8 -7
  5. node v14.18/async_hooks.d.ts → node/async_hooks.d.ts +11 -7
  6. node/base.d.ts +19 -0
  7. node/buffer.d.ts +26 -0
  8. node v14.18/child_process.d.ts → node/child_process.d.ts +71 -71
  9. node v14.18/cluster.d.ts → node/cluster.d.ts +17 -16
  10. node v14.18/console.d.ts → node/console.d.ts +17 -22
  11. node v14.18/constants.d.ts → node/constants.d.ts +9 -8
  12. node v14.18/crypto.d.ts → node/crypto.d.ts +139 -54
  13. node v14.18/dgram.d.ts → node/dgram.d.ts +24 -23
  14. node/dns/promises.d.ts +101 -0
  15. node/dns.d.ts +326 -0
  16. node v14.18/domain.d.ts → node/domain.d.ts +5 -4
  17. node v14.18/events.d.ts → node/events.d.ts +13 -8
  18. node v14.18/fs/promises.d.ts → node/fs/promises.d.ts +23 -30
  19. node v14.18/fs.d.ts → node/fs.d.ts +85 -97
  20. node v14.18/globals.d.ts → node/globals.d.ts +60 -24
  21. {node v14.18 → node}/globals.global.d.ts +0 -0
  22. node v14.18/http.d.ts → node/http.d.ts +114 -178
  23. node v14.18/http2.d.ts → node/http2.d.ts +86 -79
  24. node/https.d.ts +40 -0
  25. node v14.18/index.d.ts → node/index.d.ts +14 -55
  26. node v14.18/inspector.d.ts → node/inspector.d.ts +159 -162
  27. node v14.18/module.d.ts → node/module.d.ts +6 -5
  28. node v14.18/net.d.ts → node/net.d.ts +77 -45
  29. node v14.18/os.d.ts → node/os.d.ts +4 -3
  30. node v14.18/package.json → node/package.json +20 -19
  31. node v14.18/path.d.ts → node/path.d.ts +10 -9
  32. node v14.18/perf_hooks.d.ts → node/perf_hooks.d.ts +10 -9
  33. node v14.18/process.d.ts → node/process.d.ts +58 -18
  34. node v14.18/punycode.d.ts → node/punycode.d.ts +11 -3
  35. node v14.18/querystring.d.ts → node/querystring.d.ts +7 -6
  36. node v14.18/readline.d.ts → node/readline.d.ts +19 -19
  37. node v14.18/repl.d.ts → node/repl.d.ts +24 -23
  38. node/stream/promises.d.ts +71 -0
  39. node v14.18/stream.d.ts → node/stream.d.ts +170 -61
  40. node v14.18/string_decoder.d.ts → node/string_decoder.d.ts +4 -3
  41. node/timers/promises.d.ts +17 -0
  42. node v14.18/timers.d.ts → node/timers.d.ts +20 -5
  43. node v14.18/tls.d.ts → node/tls.d.ts +56 -57
  44. node v14.18/trace_events.d.ts → node/trace_events.d.ts +4 -3
  45. node/ts3.6/assert.d.ts +103 -0
  46. node/ts3.6/base.d.ts +66 -0
  47. node/ts3.6/index.d.ts +7 -0
  48. node v14.18/tty.d.ts → node/tty.d.ts +5 -4
  49. node v14.18/url.d.ts → node/url.d.ts +21 -20
  50. node v14.18/util.d.ts → node/util.d.ts +7 -12
  51. node v14.18/v8.d.ts → node/v8.d.ts +5 -4
  52. node v14.18/vm.d.ts → node/vm.d.ts +29 -28
  53. node v14.18/wasi.d.ts → node/wasi.d.ts +11 -10
  54. node v14.18/worker_threads.d.ts → node/worker_threads.d.ts +27 -23
  55. node v14.18/zlib.d.ts → node/zlib.d.ts +21 -20
  56. node v14.18/README.md +0 -16
  57. node v14.18/buffer.d.ts +0 -89
  58. node v14.18/dns.d.ts +0 -387
  59. node v14.18/https.d.ts +0 -142
@@ -1,12 +1,16 @@
1
+ declare module 'node:readline' {
2
+ export * from 'readline';
3
+ }
4
+
1
5
  declare module 'readline' {
2
- import EventEmitter = require('events');
6
+ import EventEmitter = require('node:events');
3
7
 
4
8
  interface Key {
5
- sequence?: string | undefined;
6
- name?: string | undefined;
7
- ctrl?: boolean | undefined;
8
- meta?: boolean | undefined;
9
- shift?: boolean | undefined;
9
+ sequence?: string;
10
+ name?: string;
11
+ ctrl?: boolean;
12
+ meta?: boolean;
13
+ shift?: boolean;
10
14
  }
11
15
 
12
16
  class Interface extends EventEmitter {
@@ -45,7 +49,6 @@ declare module 'readline' {
45
49
  resume(): this;
46
50
  close(): void;
47
51
  write(data: string | Buffer, key?: Key): void;
48
- write(data: undefined | null | string | Buffer, key: Key): void;
49
52
 
50
53
  /**
51
54
  * Returns the real position of the cursor in relation to the input
@@ -130,15 +133,15 @@ declare module 'readline' {
130
133
 
131
134
  interface ReadLineOptions {
132
135
  input: NodeJS.ReadableStream;
133
- output?: NodeJS.WritableStream | undefined;
134
- completer?: Completer | AsyncCompleter | undefined;
135
- terminal?: boolean | undefined;
136
- historySize?: number | undefined;
137
- prompt?: string | undefined;
138
- crlfDelay?: number | undefined;
139
- removeHistoryDuplicates?: boolean | undefined;
140
- escapeCodeTimeout?: number | undefined;
141
- tabSize?: number | undefined;
136
+ output?: NodeJS.WritableStream;
137
+ completer?: Completer | AsyncCompleter;
138
+ terminal?: boolean;
139
+ historySize?: number;
140
+ prompt?: string;
141
+ crlfDelay?: number;
142
+ removeHistoryDuplicates?: boolean;
143
+ escapeCodeTimeout?: number;
144
+ tabSize?: number;
142
145
  }
143
146
 
144
147
  function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
@@ -169,6 +172,3 @@ declare module 'readline' {
169
172
  */
170
173
  function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
171
174
  }
172
- declare module 'node:readline' {
173
- export * from 'readline';
174
- }
@@ -1,31 +1,35 @@
1
+ declare module 'node:repl' {
2
+ export * from 'repl';
3
+ }
4
+
1
5
  declare module 'repl' {
2
- import { Interface, Completer, AsyncCompleter } from 'readline';
3
- import { Context } from 'vm';
4
- import { InspectOptions } from 'util';
6
+ import { Interface, Completer, AsyncCompleter } from 'node:readline';
7
+ import { Context } from 'node:vm';
8
+ import { InspectOptions } from 'node:util';
5
9
 
6
10
  interface ReplOptions {
7
11
  /**
8
12
  * The input prompt to display.
9
- * @default "> "
13
+ * Default: `"> "`
10
14
  */
11
- prompt?: string | undefined;
15
+ prompt?: string;
12
16
  /**
13
17
  * The `Readable` stream from which REPL input will be read.
14
- * @default process.stdin
18
+ * Default: `process.stdin`
15
19
  */
16
- input?: NodeJS.ReadableStream | undefined;
20
+ input?: NodeJS.ReadableStream;
17
21
  /**
18
22
  * The `Writable` stream to which REPL output will be written.
19
- * @default process.stdout
23
+ * Default: `process.stdout`
20
24
  */
21
- output?: NodeJS.WritableStream | undefined;
25
+ output?: NodeJS.WritableStream;
22
26
  /**
23
27
  * If `true`, specifies that the output should be treated as a TTY terminal, and have
24
28
  * ANSI/VT100 escape codes written to it.
25
29
  * Default: checking the value of the `isTTY` property on the output stream upon
26
30
  * instantiation.
27
31
  */
28
- terminal?: boolean | undefined;
32
+ terminal?: boolean;
29
33
  /**
30
34
  * The function to be used when evaluating each given line of input.
31
35
  * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can
@@ -35,45 +39,45 @@ declare module 'repl' {
35
39
  * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation
36
40
  * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions
37
41
  */
38
- eval?: REPLEval | undefined;
42
+ eval?: REPLEval;
39
43
  /**
40
44
  * Defines if the repl prints output previews or not.
41
45
  * @default `true` Always `false` in case `terminal` is falsy.
42
46
  */
43
- preview?: boolean | undefined;
47
+ preview?: boolean;
44
48
  /**
45
49
  * If `true`, specifies that the default `writer` function should include ANSI color
46
50
  * styling to REPL output. If a custom `writer` function is provided then this has no
47
51
  * effect.
48
52
  * Default: the REPL instance's `terminal` value.
49
53
  */
50
- useColors?: boolean | undefined;
54
+ useColors?: boolean;
51
55
  /**
52
56
  * If `true`, specifies that the default evaluation function will use the JavaScript
53
57
  * `global` as the context as opposed to creating a new separate context for the REPL
54
58
  * instance. The node CLI REPL sets this value to `true`.
55
59
  * Default: `false`.
56
60
  */
57
- useGlobal?: boolean | undefined;
61
+ useGlobal?: boolean;
58
62
  /**
59
63
  * If `true`, specifies that the default writer will not output the return value of a
60
64
  * command if it evaluates to `undefined`.
61
65
  * Default: `false`.
62
66
  */
63
- ignoreUndefined?: boolean | undefined;
67
+ ignoreUndefined?: boolean;
64
68
  /**
65
69
  * The function to invoke to format the output of each command before writing to `output`.
66
70
  * Default: a wrapper for `util.inspect`.
67
71
  *
68
72
  * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output
69
73
  */
70
- writer?: REPLWriter | undefined;
74
+ writer?: REPLWriter;
71
75
  /**
72
76
  * An optional function used for custom Tab auto completion.
73
77
  *
74
78
  * @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function
75
79
  */
76
- completer?: Completer | AsyncCompleter | undefined;
80
+ completer?: Completer | AsyncCompleter;
77
81
  /**
78
82
  * A flag that specifies whether the default evaluator executes all JavaScript commands in
79
83
  * strict mode or default (sloppy) mode.
@@ -82,13 +86,13 @@ declare module 'repl' {
82
86
  * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
83
87
  * prefacing every repl statement with `'use strict'`.
84
88
  */
85
- replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT | undefined;
89
+ replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT;
86
90
  /**
87
91
  * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is
88
92
  * pressed. This cannot be used together with a custom `eval` function.
89
93
  * Default: `false`.
90
94
  */
91
- breakEvalOnSigint?: boolean | undefined;
95
+ breakEvalOnSigint?: boolean;
92
96
  }
93
97
 
94
98
  type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void;
@@ -106,7 +110,7 @@ declare module 'repl' {
106
110
  /**
107
111
  * Help text to be displayed when `.help` is entered.
108
112
  */
109
- help?: string | undefined;
113
+ help?: string;
110
114
  /**
111
115
  * The function to execute, optionally accepting a single string argument.
112
116
  */
@@ -393,6 +397,3 @@ declare module 'repl' {
393
397
  constructor(err: Error);
394
398
  }
395
399
  }
396
- declare module 'node:repl' {
397
- export * from 'repl';
398
- }
@@ -0,0 +1,71 @@
1
+ declare module "node:stream/promises" {
2
+ export * from "stream/promises";
3
+ }
4
+
5
+ declare module "stream/promises" {
6
+ import { FinishedOptions, PipelineSource, PipelineTransform,
7
+ PipelineDestination, PipelinePromise, PipelineOptions } from "stream";
8
+
9
+ function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
10
+
11
+ function pipeline<A extends PipelineSource<any>,
12
+ B extends PipelineDestination<A, any>>(
13
+ source: A,
14
+ destination: B,
15
+ options?: PipelineOptions
16
+ ): PipelinePromise<B>;
17
+ function pipeline<A extends PipelineSource<any>,
18
+ T1 extends PipelineTransform<A, any>,
19
+ B extends PipelineDestination<T1, any>>(
20
+ source: A,
21
+ transform1: T1,
22
+ destination: B,
23
+ options?: PipelineOptions
24
+ ): PipelinePromise<B>;
25
+ function pipeline<A extends PipelineSource<any>,
26
+ T1 extends PipelineTransform<A, any>,
27
+ T2 extends PipelineTransform<T1, any>,
28
+ B extends PipelineDestination<T2, any>>(
29
+ source: A,
30
+ transform1: T1,
31
+ transform2: T2,
32
+ destination: B,
33
+ options?: PipelineOptions
34
+ ): PipelinePromise<B>;
35
+ function pipeline<A extends PipelineSource<any>,
36
+ T1 extends PipelineTransform<A, any>,
37
+ T2 extends PipelineTransform<T1, any>,
38
+ T3 extends PipelineTransform<T2, any>,
39
+ B extends PipelineDestination<T3, any>>(
40
+ source: A,
41
+ transform1: T1,
42
+ transform2: T2,
43
+ transform3: T3,
44
+ destination: B,
45
+ options?: PipelineOptions
46
+ ): PipelinePromise<B>;
47
+ function pipeline<A extends PipelineSource<any>,
48
+ T1 extends PipelineTransform<A, any>,
49
+ T2 extends PipelineTransform<T1, any>,
50
+ T3 extends PipelineTransform<T2, any>,
51
+ T4 extends PipelineTransform<T3, any>,
52
+ B extends PipelineDestination<T4, any>>(
53
+ source: A,
54
+ transform1: T1,
55
+ transform2: T2,
56
+ transform3: T3,
57
+ transform4: T4,
58
+ destination: B,
59
+ options?: PipelineOptions
60
+ ): PipelinePromise<B>;
61
+
62
+ function pipeline(
63
+ streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
64
+ options?: PipelineOptions
65
+ ): Promise<void>;
66
+ function pipeline(
67
+ stream1: NodeJS.ReadableStream,
68
+ stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
69
+ ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>,
70
+ ): Promise<void>;
71
+ }
@@ -1,8 +1,14 @@
1
+ declare module 'node:stream' {
2
+ import Stream = require('stream');
3
+ export = Stream;
4
+ }
5
+
1
6
  declare module 'stream' {
2
- import EventEmitter = require('events');
7
+ import EventEmitter = require('node:events');
8
+ import * as streamPromises from "node:stream/promises";
3
9
 
4
10
  class internal extends EventEmitter {
5
- pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
11
+ pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
6
12
  }
7
13
 
8
14
  namespace internal {
@@ -11,12 +17,13 @@ declare module 'stream' {
11
17
  }
12
18
 
13
19
  interface ReadableOptions {
14
- highWaterMark?: number | undefined;
15
- encoding?: BufferEncoding | undefined;
16
- objectMode?: boolean | undefined;
20
+ highWaterMark?: number;
21
+ encoding?: BufferEncoding;
22
+ objectMode?: boolean;
17
23
  read?(this: Readable, size: number): void;
24
+ construct?(this: Readable, callback: (error?: Error | null) => void): void;
18
25
  destroy?(this: Readable, error: Error | null, callback: (error: Error | null) => void): void;
19
- autoDestroy?: boolean | undefined;
26
+ autoDestroy?: boolean;
20
27
  }
21
28
 
22
29
  class Readable extends Stream implements NodeJS.ReadableStream {
@@ -34,6 +41,7 @@ declare module 'stream' {
34
41
  readonly readableObjectMode: boolean;
35
42
  destroyed: boolean;
36
43
  constructor(opts?: ReadableOptions);
44
+ _construct?(callback: (error?: Error | null) => void): void;
37
45
  _read(size: number): void;
38
46
  read(size?: number): any;
39
47
  setEncoding(encoding: BufferEncoding): this;
@@ -45,7 +53,7 @@ declare module 'stream' {
45
53
  wrap(oldStream: NodeJS.ReadableStream): this;
46
54
  push(chunk: any, encoding?: BufferEncoding): boolean;
47
55
  _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
48
- destroy(error?: Error): this;
56
+ destroy(error?: Error): void;
49
57
 
50
58
  /**
51
59
  * Event emitter
@@ -125,16 +133,17 @@ declare module 'stream' {
125
133
  }
126
134
 
127
135
  interface WritableOptions {
128
- highWaterMark?: number | undefined;
129
- decodeStrings?: boolean | undefined;
130
- defaultEncoding?: BufferEncoding | undefined;
131
- objectMode?: boolean | undefined;
132
- emitClose?: boolean | undefined;
136
+ highWaterMark?: number;
137
+ decodeStrings?: boolean;
138
+ defaultEncoding?: BufferEncoding;
139
+ objectMode?: boolean;
140
+ emitClose?: boolean;
141
+ construct?(this: Writable, callback: (error?: Error | null) => void): void;
133
142
  write?(this: Writable, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
134
143
  writev?(this: Writable, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
135
144
  destroy?(this: Writable, error: Error | null, callback: (error: Error | null) => void): void;
136
145
  final?(this: Writable, callback: (error?: Error | null) => void): void;
137
- autoDestroy?: boolean | undefined;
146
+ autoDestroy?: boolean;
138
147
  }
139
148
 
140
149
  class Writable extends Stream implements NodeJS.WritableStream {
@@ -149,17 +158,18 @@ declare module 'stream' {
149
158
  constructor(opts?: WritableOptions);
150
159
  _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
151
160
  _writev?(chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
161
+ _construct?(callback: (error?: Error | null) => void): void;
152
162
  _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
153
163
  _final(callback: (error?: Error | null) => void): void;
154
164
  write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
155
165
  write(chunk: any, encoding: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean;
156
166
  setDefaultEncoding(encoding: BufferEncoding): this;
157
- end(cb?: () => void): this;
158
- end(chunk: any, cb?: () => void): this;
159
- end(chunk: any, encoding: BufferEncoding, cb?: () => void): this;
167
+ end(cb?: () => void): void;
168
+ end(chunk: any, cb?: () => void): void;
169
+ end(chunk: any, encoding: BufferEncoding, cb?: () => void): void;
160
170
  cork(): void;
161
171
  uncork(): void;
162
- destroy(error?: Error): this;
172
+ destroy(error?: Error): void;
163
173
 
164
174
  /**
165
175
  * Event emitter
@@ -229,12 +239,13 @@ declare module 'stream' {
229
239
  }
230
240
 
231
241
  interface DuplexOptions extends ReadableOptions, WritableOptions {
232
- allowHalfOpen?: boolean | undefined;
233
- readableObjectMode?: boolean | undefined;
234
- writableObjectMode?: boolean | undefined;
235
- readableHighWaterMark?: number | undefined;
236
- writableHighWaterMark?: number | undefined;
237
- writableCorked?: number | undefined;
242
+ allowHalfOpen?: boolean;
243
+ readableObjectMode?: boolean;
244
+ writableObjectMode?: boolean;
245
+ readableHighWaterMark?: number;
246
+ writableHighWaterMark?: number;
247
+ writableCorked?: number;
248
+ construct?(this: Duplex, callback: (error?: Error | null) => void): void;
238
249
  read?(this: Duplex, size: number): void;
239
250
  write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
240
251
  writev?(this: Duplex, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
@@ -251,7 +262,6 @@ declare module 'stream' {
251
262
  readonly writableLength: number;
252
263
  readonly writableObjectMode: boolean;
253
264
  readonly writableCorked: number;
254
- allowHalfOpen: boolean;
255
265
  constructor(opts?: DuplexOptions);
256
266
  _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
257
267
  _writev?(chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
@@ -260,9 +270,9 @@ declare module 'stream' {
260
270
  write(chunk: any, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean;
261
271
  write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
262
272
  setDefaultEncoding(encoding: BufferEncoding): this;
263
- end(cb?: () => void): this;
264
- end(chunk: any, cb?: () => void): this;
265
- end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this;
273
+ end(cb?: () => void): void;
274
+ end(chunk: any, cb?: () => void): void;
275
+ end(chunk: any, encoding?: BufferEncoding, cb?: () => void): void;
266
276
  cork(): void;
267
277
  uncork(): void;
268
278
  }
@@ -270,6 +280,7 @@ declare module 'stream' {
270
280
  type TransformCallback = (error?: Error | null, data?: any) => void;
271
281
 
272
282
  interface TransformOptions extends DuplexOptions {
283
+ construct?(this: Transform, callback: (error?: Error | null) => void): void;
273
284
  read?(this: Transform, size: number): void;
274
285
  write?(this: Transform, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
275
286
  writev?(this: Transform, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
@@ -288,9 +299,9 @@ declare module 'stream' {
288
299
  class PassThrough extends Transform { }
289
300
 
290
301
  interface FinishedOptions {
291
- error?: boolean | undefined;
292
- readable?: boolean | undefined;
293
- writable?: boolean | undefined;
302
+ error?: boolean;
303
+ readable?: boolean;
304
+ writable?: boolean;
294
305
  }
295
306
  function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
296
307
  function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
@@ -298,23 +309,79 @@ declare module 'stream' {
298
309
  function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
299
310
  }
300
311
 
301
- function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T;
302
- function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException | null) => void): T;
303
- function pipeline<T extends NodeJS.WritableStream>(
304
- stream1: NodeJS.ReadableStream,
305
- stream2: NodeJS.ReadWriteStream,
306
- stream3: NodeJS.ReadWriteStream,
307
- stream4: T,
308
- callback?: (err: NodeJS.ErrnoException | null) => void,
309
- ): T;
310
- function pipeline<T extends NodeJS.WritableStream>(
311
- stream1: NodeJS.ReadableStream,
312
- stream2: NodeJS.ReadWriteStream,
313
- stream3: NodeJS.ReadWriteStream,
314
- stream4: NodeJS.ReadWriteStream,
315
- stream5: T,
316
- callback?: (err: NodeJS.ErrnoException | null) => void,
317
- ): T;
312
+ type PipelineSourceFunction<T> = () => Iterable<T> | AsyncIterable<T>;
313
+ type PipelineSource<T> = Iterable<T> | AsyncIterable<T> | NodeJS.ReadableStream | PipelineSourceFunction<T>;
314
+ type PipelineTransform<S extends PipelineTransformSource<any>, U> =
315
+ NodeJS.ReadWriteStream |
316
+ ((source: S extends (...args: any[]) => Iterable<infer ST> | AsyncIterable<infer ST> ?
317
+ AsyncIterable<ST> : S) => AsyncIterable<U>);
318
+ type PipelineTransformSource<T> = PipelineSource<T> | PipelineTransform<any, T>;
319
+
320
+ type PipelineDestinationIterableFunction<T> = (source: AsyncIterable<T>) => AsyncIterable<any>;
321
+ type PipelineDestinationPromiseFunction<T, P> = (source: AsyncIterable<T>) => Promise<P>;
322
+
323
+ type PipelineDestination<S extends PipelineTransformSource<any>, P> =
324
+ S extends PipelineTransformSource<infer ST> ?
325
+ (NodeJS.WritableStream | PipelineDestinationIterableFunction<ST> | PipelineDestinationPromiseFunction<ST, P>) : never;
326
+ type PipelineCallback<S extends PipelineDestination<any, any>> =
327
+ S extends PipelineDestinationPromiseFunction<any, infer P> ? (err: NodeJS.ErrnoException | null, value: P) => void :
328
+ (err: NodeJS.ErrnoException | null) => void;
329
+ type PipelinePromise<S extends PipelineDestination<any, any>> =
330
+ S extends PipelineDestinationPromiseFunction<any, infer P> ? Promise<P> : Promise<void>;
331
+ interface PipelineOptions {
332
+ signal: AbortSignal;
333
+ }
334
+
335
+ function pipeline<A extends PipelineSource<any>,
336
+ B extends PipelineDestination<A, any>>(
337
+ source: A,
338
+ destination: B,
339
+ callback?: PipelineCallback<B>
340
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
341
+ function pipeline<A extends PipelineSource<any>,
342
+ T1 extends PipelineTransform<A, any>,
343
+ B extends PipelineDestination<T1, any>>(
344
+ source: A,
345
+ transform1: T1,
346
+ destination: B,
347
+ callback?: PipelineCallback<B>
348
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
349
+ function pipeline<A extends PipelineSource<any>,
350
+ T1 extends PipelineTransform<A, any>,
351
+ T2 extends PipelineTransform<T1, any>,
352
+ B extends PipelineDestination<T2, any>>(
353
+ source: A,
354
+ transform1: T1,
355
+ transform2: T2,
356
+ destination: B,
357
+ callback?: PipelineCallback<B>
358
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
359
+ function pipeline<A extends PipelineSource<any>,
360
+ T1 extends PipelineTransform<A, any>,
361
+ T2 extends PipelineTransform<T1, any>,
362
+ T3 extends PipelineTransform<T2, any>,
363
+ B extends PipelineDestination<T3, any>>(
364
+ source: A,
365
+ transform1: T1,
366
+ transform2: T2,
367
+ transform3: T3,
368
+ destination: B,
369
+ callback?: PipelineCallback<B>
370
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
371
+ function pipeline<A extends PipelineSource<any>,
372
+ T1 extends PipelineTransform<A, any>,
373
+ T2 extends PipelineTransform<T1, any>,
374
+ T3 extends PipelineTransform<T2, any>,
375
+ T4 extends PipelineTransform<T3, any>,
376
+ B extends PipelineDestination<T4, any>>(
377
+ source: A,
378
+ transform1: T1,
379
+ transform2: T2,
380
+ transform3: T3,
381
+ transform4: T4,
382
+ destination: B,
383
+ callback?: PipelineCallback<B>
384
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
318
385
  function pipeline(
319
386
  streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
320
387
  callback?: (err: NodeJS.ErrnoException | null) => void,
@@ -325,21 +392,65 @@ declare module 'stream' {
325
392
  ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void)>,
326
393
  ): NodeJS.WritableStream;
327
394
  namespace pipeline {
328
- function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.WritableStream): Promise<void>;
329
- function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.WritableStream): Promise<void>;
330
- function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.ReadWriteStream, stream4: NodeJS.WritableStream): Promise<void>;
395
+ function __promisify__<A extends PipelineSource<any>,
396
+ B extends PipelineDestination<A, any>>(
397
+ source: A,
398
+ destination: B,
399
+ options?: PipelineOptions
400
+ ): PipelinePromise<B>;
401
+ function __promisify__<A extends PipelineSource<any>,
402
+ T1 extends PipelineTransform<A, any>,
403
+ B extends PipelineDestination<T1, any>>(
404
+ source: A,
405
+ transform1: T1,
406
+ destination: B,
407
+ options?: PipelineOptions,
408
+ ): PipelinePromise<B>;
409
+ function __promisify__<A extends PipelineSource<any>,
410
+ T1 extends PipelineTransform<A, any>,
411
+ T2 extends PipelineTransform<T1, any>,
412
+ B extends PipelineDestination<T2, any>>(
413
+ source: A,
414
+ transform1: T1,
415
+ transform2: T2,
416
+ destination: B,
417
+ options?: PipelineOptions
418
+ ): PipelinePromise<B>;
419
+ function __promisify__<A extends PipelineSource<any>,
420
+ T1 extends PipelineTransform<A, any>,
421
+ T2 extends PipelineTransform<T1, any>,
422
+ T3 extends PipelineTransform<T2, any>,
423
+ B extends PipelineDestination<T3, any>>(
424
+ source: A,
425
+ transform1: T1,
426
+ transform2: T2,
427
+ transform3: T3,
428
+ destination: B,
429
+ options?: PipelineOptions
430
+ ): PipelinePromise<B>;
431
+ function __promisify__<A extends PipelineSource<any>,
432
+ T1 extends PipelineTransform<A, any>,
433
+ T2 extends PipelineTransform<T1, any>,
434
+ T3 extends PipelineTransform<T2, any>,
435
+ T4 extends PipelineTransform<T3, any>,
436
+ B extends PipelineDestination<T4, any>>(
437
+ source: A,
438
+ transform1: T1,
439
+ transform2: T2,
440
+ transform3: T3,
441
+ transform4: T4,
442
+ destination: B,
443
+ options?: PipelineOptions
444
+ ): PipelinePromise<B>;
445
+
331
446
  function __promisify__(
332
- stream1: NodeJS.ReadableStream,
333
- stream2: NodeJS.ReadWriteStream,
334
- stream3: NodeJS.ReadWriteStream,
335
- stream4: NodeJS.ReadWriteStream,
336
- stream5: NodeJS.WritableStream,
447
+ streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
448
+ options?: PipelineOptions
337
449
  ): Promise<void>;
338
- function __promisify__(streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>): Promise<void>;
339
450
  function __promisify__(
340
451
  stream1: NodeJS.ReadableStream,
341
452
  stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
342
- ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream>,
453
+ ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>,
343
454
  ): Promise<void>;
344
455
  }
345
456
 
@@ -349,11 +460,9 @@ declare module 'stream' {
349
460
  ref(): void;
350
461
  unref(): void;
351
462
  }
463
+
464
+ const promises: typeof streamPromises;
352
465
  }
353
466
 
354
467
  export = internal;
355
468
  }
356
- declare module 'node:stream' {
357
- import stream = require('stream');
358
- export = stream;
359
- }
@@ -1,3 +1,7 @@
1
+ declare module 'node:string_decoder' {
2
+ export * from 'string_decoder';
3
+ }
4
+
1
5
  declare module 'string_decoder' {
2
6
  class StringDecoder {
3
7
  constructor(encoding?: BufferEncoding);
@@ -5,6 +9,3 @@ declare module 'string_decoder' {
5
9
  end(buffer?: Buffer): string;
6
10
  }
7
11
  }
8
- declare module 'node:string_decoder' {
9
- export * from 'string_decoder';
10
- }
@@ -0,0 +1,17 @@
1
+ declare module 'node:timers/promises' {
2
+ export * from 'timers/promises';
3
+ }
4
+
5
+ declare module 'timers/promises' {
6
+ import { TimerOptions } from 'node:timers';
7
+
8
+ /**
9
+ * Returns a promise that resolves after the specified delay in milliseconds.
10
+ */
11
+ function setTimeout<T>(delay: number, value?: T, options?: TimerOptions): Promise<T>;
12
+
13
+ /**
14
+ * Returns a promise that resolves in the next tick.
15
+ */
16
+ function setImmediate<T>(value: T, options?: TimerOptions): Promise<T>;
17
+ }