@types/node 14.18.9 → 15.0.3

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