@types/node 15.14.7 → 16.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 (65) hide show
  1. {node v15.14 → node}/LICENSE +0 -0
  2. node v15.14/README.md → node/README.md +3 -3
  3. node/assert/strict.d.ts +9 -0
  4. node v15.14/assert.d.ts → node/assert.d.ts +35 -30
  5. node v15.14/async_hooks.d.ts → node/async_hooks.d.ts +7 -3
  6. {node v15.14 → node}/base.d.ts +0 -0
  7. node/buffer.d.ts +357 -0
  8. node v15.14/child_process.d.ts → node/child_process.d.ts +54 -50
  9. node v15.14/cluster.d.ts → node/cluster.d.ts +33 -108
  10. node v15.14/console.d.ts → node/console.d.ts +24 -23
  11. node v15.14/constants.d.ts → node/constants.d.ts +5 -0
  12. node v15.14/crypto.d.ts → node/crypto.d.ts +82 -67
  13. node v15.14/dgram.d.ts → node/dgram.d.ts +13 -9
  14. node v15.14/diagnostic_channel.d.ts → node/diagnostic_channel.d.ts +4 -0
  15. node v15.14/dns/promises.d.ts → node/dns/promises.d.ts +4 -0
  16. node v15.14/dns.d.ts → node/dns.d.ts +15 -11
  17. node/domain.d.ts +25 -0
  18. node v15.14/events.d.ts → node/events.d.ts +8 -3
  19. node v15.14/fs/promises.d.ts → node/fs/promises.d.ts +25 -17
  20. node v15.14/fs.d.ts → node/fs.d.ts +71 -75
  21. node/globals.d.ts +274 -0
  22. node/globals.global.d.ts +1 -0
  23. node v15.14/http.d.ts → node/http.d.ts +109 -167
  24. node v15.14/http2.d.ts → node/http2.d.ts +69 -66
  25. node/https.d.ts +40 -0
  26. node v15.14/index.d.ts → node/index.d.ts +1 -1
  27. node v15.14/inspector.d.ts → node/inspector.d.ts +152 -470
  28. node v15.14/module.d.ts → node/module.d.ts +25 -4
  29. node v15.14/net.d.ts → node/net.d.ts +34 -36
  30. node v15.14/os.d.ts → node/os.d.ts +4 -0
  31. node v15.14/package.json → node/package.json +2 -2
  32. node v15.14/path.d.ts → node/path.d.ts +10 -5
  33. node v15.14/perf_hooks.d.ts → node/perf_hooks.d.ts +70 -23
  34. node v15.14/process.d.ts → node/process.d.ts +54 -51
  35. node v15.14/punycode.d.ts → node/punycode.d.ts +4 -0
  36. node v15.14/querystring.d.ts → node/querystring.d.ts +7 -3
  37. node v15.14/readline.d.ts → node/readline.d.ts +20 -16
  38. node v15.14/repl.d.ts → node/repl.d.ts +18 -14
  39. node v15.14/stream/promises.d.ts → node/stream/promises.d.ts +4 -0
  40. node v15.14/stream.d.ts → node/stream.d.ts +22 -17
  41. node v15.14/string_decoder.d.ts → node/string_decoder.d.ts +4 -0
  42. node v15.14/timers/promises.d.ts → node/timers/promises.d.ts +4 -0
  43. node/timers.d.ts +92 -0
  44. node v15.14/tls.d.ts → node/tls.d.ts +54 -50
  45. node v15.14/trace_events.d.ts → node/trace_events.d.ts +4 -0
  46. node v15.14/ts3.6/assert.d.ts → node/ts3.6/assert.d.ts +26 -26
  47. {node v15.14 → node}/ts3.6/base.d.ts +0 -0
  48. {node v15.14 → node}/ts3.6/index.d.ts +0 -0
  49. node v15.14/tty.d.ts → node/tty.d.ts +4 -0
  50. node v15.14/url.d.ts → node/url.d.ts +19 -15
  51. node/util/types.d.ts +57 -0
  52. node v15.14/util.d.ts → node/util.d.ts +67 -21
  53. node v15.14/v8.d.ts → node/v8.d.ts +4 -0
  54. node v15.14/vm.d.ts → node/vm.d.ts +28 -24
  55. node v15.14/wasi.d.ts → node/wasi.d.ts +11 -7
  56. node v15.14/worker_threads.d.ts → node/worker_threads.d.ts +19 -15
  57. node v15.14/zlib.d.ts → node/zlib.d.ts +20 -16
  58. node v15.14/assert/strict.d.ts +0 -4
  59. node v15.14/buffer.d.ts +0 -112
  60. node v15.14/domain.d.ts +0 -24
  61. node v15.14/globals.d.ts +0 -659
  62. node v15.14/globals.global.d.ts +0 -1
  63. node v15.14/https.d.ts +0 -139
  64. node v15.14/timers.d.ts +0 -27
  65. node v15.14/util/types.d.ts +0 -53
@@ -2,11 +2,11 @@ declare module 'readline' {
2
2
  import { Abortable, EventEmitter } from 'events';
3
3
 
4
4
  interface Key {
5
- sequence?: string;
6
- name?: string;
7
- ctrl?: boolean;
8
- meta?: boolean;
9
- shift?: boolean;
5
+ sequence?: string | undefined;
6
+ name?: string | undefined;
7
+ ctrl?: boolean | undefined;
8
+ meta?: boolean | undefined;
9
+ shift?: boolean | undefined;
10
10
  }
11
11
 
12
12
  class Interface extends EventEmitter {
@@ -132,34 +132,34 @@ declare module 'readline' {
132
132
  type ReadLine = Interface; // type forwarded for backwards compatibility
133
133
 
134
134
  type Completer = (line: string) => CompleterResult;
135
- type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => any;
135
+ type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => void;
136
136
 
137
137
  type CompleterResult = [string[], string];
138
138
 
139
139
  interface ReadLineOptions {
140
140
  input: NodeJS.ReadableStream;
141
- output?: NodeJS.WritableStream;
142
- completer?: Completer | AsyncCompleter;
143
- terminal?: boolean;
141
+ output?: NodeJS.WritableStream | undefined;
142
+ completer?: Completer | AsyncCompleter | undefined;
143
+ terminal?: boolean | undefined;
144
144
  /**
145
145
  * Initial list of history lines. This option makes sense
146
146
  * only if `terminal` is set to `true` by the user or by an internal `output`
147
147
  * check, otherwise the history caching mechanism is not initialized at all.
148
148
  * @default []
149
149
  */
150
- history?: string[];
151
- historySize?: number;
152
- prompt?: string;
153
- crlfDelay?: number;
150
+ history?: string[] | undefined;
151
+ historySize?: number | undefined;
152
+ prompt?: string | undefined;
153
+ crlfDelay?: number | undefined;
154
154
  /**
155
155
  * If `true`, when a new input line added
156
156
  * to the history list duplicates an older one, this removes the older line
157
157
  * from the list.
158
158
  * @default false
159
159
  */
160
- removeHistoryDuplicates?: boolean;
161
- escapeCodeTimeout?: number;
162
- tabSize?: number;
160
+ removeHistoryDuplicates?: boolean | undefined;
161
+ escapeCodeTimeout?: number | undefined;
162
+ tabSize?: number | undefined;
163
163
  }
164
164
 
165
165
  function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
@@ -190,3 +190,7 @@ declare module 'readline' {
190
190
  */
191
191
  function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
192
192
  }
193
+
194
+ declare module 'node:readline' {
195
+ export * from 'readline';
196
+ }
@@ -8,24 +8,24 @@ declare module 'repl' {
8
8
  * The input prompt to display.
9
9
  * @default "> "
10
10
  */
11
- prompt?: string;
11
+ prompt?: string | undefined;
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;
16
+ input?: NodeJS.ReadableStream | undefined;
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;
21
+ output?: NodeJS.WritableStream | undefined;
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;
28
+ terminal?: boolean | undefined;
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;
38
+ eval?: REPLEval | undefined;
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;
43
+ preview?: boolean | undefined;
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;
50
+ useColors?: boolean | undefined;
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;
57
+ useGlobal?: boolean | undefined;
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;
63
+ ignoreUndefined?: boolean | undefined;
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;
70
+ writer?: REPLWriter | undefined;
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;
76
+ completer?: Completer | AsyncCompleter | undefined;
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;
85
+ replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT | undefined;
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;
91
+ breakEvalOnSigint?: boolean | undefined;
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;
109
+ help?: string | undefined;
110
110
  /**
111
111
  * The function to execute, optionally accepting a single string argument.
112
112
  */
@@ -393,3 +393,7 @@ declare module 'repl' {
393
393
  constructor(err: Error);
394
394
  }
395
395
  }
396
+
397
+ declare module 'node:repl' {
398
+ export * from 'repl';
399
+ }
@@ -65,3 +65,7 @@ declare module "stream/promises" {
65
65
  ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>,
66
66
  ): Promise<void>;
67
67
  }
68
+
69
+ declare module 'node:stream/promises' {
70
+ export * from 'stream/promises';
71
+ }
@@ -3,7 +3,7 @@ declare module 'stream' {
3
3
  import * as streamPromises from "stream/promises";
4
4
 
5
5
  class internal extends EventEmitter {
6
- pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
6
+ pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
7
7
  }
8
8
 
9
9
  namespace internal {
@@ -12,16 +12,16 @@ declare module 'stream' {
12
12
  }
13
13
 
14
14
  interface StreamOptions<T extends Stream> extends Abortable {
15
- emitClose?: boolean;
16
- highWaterMark?: number;
17
- objectMode?: boolean;
15
+ emitClose?: boolean | undefined;
16
+ highWaterMark?: number | undefined;
17
+ objectMode?: boolean | undefined;
18
18
  construct?(this: T, callback: (error?: Error | null) => void): void;
19
19
  destroy?(this: T, error: Error | null, callback: (error: Error | null) => void): void;
20
- autoDestroy?: boolean;
20
+ autoDestroy?: boolean | undefined;
21
21
  }
22
22
 
23
23
  interface ReadableOptions extends StreamOptions<Readable> {
24
- encoding?: BufferEncoding;
24
+ encoding?: BufferEncoding | undefined;
25
25
  read?(this: Readable, size: number): void;
26
26
  }
27
27
 
@@ -132,8 +132,8 @@ declare module 'stream' {
132
132
  }
133
133
 
134
134
  interface WritableOptions extends StreamOptions<Writable> {
135
- decodeStrings?: boolean;
136
- defaultEncoding?: BufferEncoding;
135
+ decodeStrings?: boolean | undefined;
136
+ defaultEncoding?: BufferEncoding | undefined;
137
137
  write?(this: Writable, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
138
138
  writev?(this: Writable, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
139
139
  final?(this: Writable, callback: (error?: Error | null) => void): void;
@@ -232,12 +232,12 @@ declare module 'stream' {
232
232
  }
233
233
 
234
234
  interface DuplexOptions extends ReadableOptions, WritableOptions {
235
- allowHalfOpen?: boolean;
236
- readableObjectMode?: boolean;
237
- writableObjectMode?: boolean;
238
- readableHighWaterMark?: number;
239
- writableHighWaterMark?: number;
240
- writableCorked?: number;
235
+ allowHalfOpen?: boolean | undefined;
236
+ readableObjectMode?: boolean | undefined;
237
+ writableObjectMode?: boolean | undefined;
238
+ readableHighWaterMark?: number | undefined;
239
+ writableHighWaterMark?: number | undefined;
240
+ writableCorked?: number | undefined;
241
241
  construct?(this: Duplex, callback: (error?: Error | null) => void): void;
242
242
  read?(this: Duplex, size: number): void;
243
243
  write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
@@ -302,9 +302,9 @@ declare module 'stream' {
302
302
  function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
303
303
 
304
304
  interface FinishedOptions extends Abortable {
305
- error?: boolean;
306
- readable?: boolean;
307
- writable?: boolean;
305
+ error?: boolean | undefined;
306
+ readable?: boolean | undefined;
307
+ writable?: boolean | undefined;
308
308
  }
309
309
  function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
310
310
  function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
@@ -469,3 +469,8 @@ declare module 'stream' {
469
469
 
470
470
  export = internal;
471
471
  }
472
+
473
+ declare module 'node:stream' {
474
+ import stream = require('stream');
475
+ export = stream;
476
+ }
@@ -5,3 +5,7 @@ declare module 'string_decoder' {
5
5
  end(buffer?: Buffer): string;
6
6
  }
7
7
  }
8
+
9
+ declare module 'node:string_decoder' {
10
+ export * from 'string_decoder';
11
+ }
@@ -19,3 +19,7 @@ declare module 'timers/promises' {
19
19
  */
20
20
  function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
21
21
  }
22
+
23
+ declare module 'node:timers/promises' {
24
+ export * from 'timers/promises';
25
+ }
node/timers.d.ts ADDED
@@ -0,0 +1,92 @@
1
+ declare module 'timers' {
2
+ import { Abortable } from 'events';
3
+ import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'timers/promises';
4
+
5
+ interface TimerOptions extends Abortable {
6
+ /**
7
+ * Set to `false` to indicate that the scheduled `Timeout`
8
+ * should not require the Node.js event loop to remain active.
9
+ * @default true
10
+ */
11
+ ref?: boolean | undefined;
12
+ }
13
+
14
+ let setTimeout: typeof global.setTimeout;
15
+ let clearTimeout: typeof global.clearTimeout;
16
+ let setInterval: typeof global.setInterval;
17
+ let clearInterval: typeof global.clearInterval;
18
+ let setImmediate: typeof global.setImmediate;
19
+ let clearImmediate: typeof global.clearImmediate;
20
+
21
+ global {
22
+ namespace NodeJS {
23
+ // compatibility with older typings
24
+ interface Timer extends RefCounted {
25
+ hasRef(): boolean;
26
+ refresh(): this;
27
+ [Symbol.toPrimitive](): number;
28
+ }
29
+
30
+ interface Immediate extends RefCounted {
31
+ hasRef(): boolean;
32
+ _onImmediate: Function; // to distinguish it from the Timeout class
33
+ }
34
+
35
+ interface Timeout extends Timer {
36
+ hasRef(): boolean;
37
+ refresh(): this;
38
+ [Symbol.toPrimitive](): number;
39
+ }
40
+ }
41
+
42
+ function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
43
+ namespace setTimeout {
44
+ const __promisify__: typeof setTimeoutPromise;
45
+ }
46
+ function clearTimeout(timeoutId: NodeJS.Timeout): void;
47
+
48
+ function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
49
+ namespace setInterval {
50
+ const __promisify__: typeof setIntervalPromise;
51
+ }
52
+ function clearInterval(intervalId: NodeJS.Timeout): void;
53
+
54
+ function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
55
+ namespace setImmediate {
56
+ const __promisify__: typeof setImmediatePromise;
57
+ }
58
+ function clearImmediate(immediateId: NodeJS.Immediate): void;
59
+
60
+ function queueMicrotask(callback: () => void): void;
61
+ }
62
+ }
63
+
64
+ declare module 'node:timers' {
65
+ export * from 'timers';
66
+ }
67
+
68
+ declare module 'timers/promises' {
69
+ import { TimerOptions } from 'timers';
70
+
71
+ /**
72
+ * Returns a promise that resolves after the specified delay in milliseconds.
73
+ * @param delay defaults to 1
74
+ */
75
+ function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
76
+
77
+ /**
78
+ * Returns a promise that resolves in the next tick.
79
+ */
80
+ function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
81
+
82
+ /**
83
+ *
84
+ * Returns an async iterator that generates values in an interval of delay ms.
85
+ * @param delay defaults to 1
86
+ */
87
+ function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
88
+ }
89
+
90
+ declare module 'node:timers/promises' {
91
+ export * from 'timers/promises';
92
+ }