@types/node 16.0.0 → 16.3.0

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 CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Sat, 03 Jul 2021 00:31:26 GMT
11
+ * Last updated: Fri, 09 Jul 2021 02:01:16 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
14
14
 
node/assert.d.ts CHANGED
@@ -11,16 +11,16 @@ declare module 'assert' {
11
11
 
12
12
  constructor(options?: {
13
13
  /** If provided, the error message is set to this value. */
14
- message?: string;
14
+ message?: string | undefined;
15
15
  /** The `actual` property on the error instance. */
16
- actual?: unknown;
16
+ actual?: unknown | undefined;
17
17
  /** The `expected` property on the error instance. */
18
- expected?: unknown;
18
+ expected?: unknown | undefined;
19
19
  /** The `operator` property on the error instance. */
20
- operator?: string;
20
+ operator?: string | undefined;
21
21
  /** If provided, the generated stack trace omits frames before this function. */
22
22
  // tslint:disable-next-line:ban-types
23
- stackStartFn?: Function;
23
+ stackStartFn?: Function | undefined;
24
24
  });
25
25
  }
26
26
 
node/async_hooks.d.ts CHANGED
@@ -87,7 +87,7 @@ declare module 'async_hooks' {
87
87
  * The ID of the execution context that created this async event.
88
88
  * @default executionAsyncId()
89
89
  */
90
- triggerAsyncId?: number;
90
+ triggerAsyncId?: number | undefined;
91
91
 
92
92
  /**
93
93
  * Disables automatic `emitDestroy` when the object is garbage collected.
@@ -96,7 +96,7 @@ declare module 'async_hooks' {
96
96
  * sensitive API's `emitDestroy` is called with it.
97
97
  * @default false
98
98
  */
99
- requireManualDestroy?: boolean;
99
+ requireManualDestroy?: boolean | undefined;
100
100
  }
101
101
 
102
102
  /**
@@ -198,8 +198,7 @@ declare module 'async_hooks' {
198
198
  * I the callback function throws an error, it will be thrown by `run` too. The
199
199
  * stacktrace will not be impacted by this call and the context will be exited.
200
200
  */
201
- // TODO: Apply generic vararg once available
202
- run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
201
+ run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
203
202
 
204
203
  /**
205
204
  * This methods runs a function synchronously outside of a context and return its
@@ -213,8 +212,7 @@ declare module 'async_hooks' {
213
212
  * stacktrace will not be impacted by this call and the context will be
214
213
  * re-entered.
215
214
  */
216
- // TODO: Apply generic vararg once available
217
- exit<R>(callback: (...args: any[]) => R, ...args: any[]): R;
215
+ exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
218
216
 
219
217
  /**
220
218
  * Calling `asyncLocalStorage.enterWith(store)` will transition into the context
node/buffer.d.ts CHANGED
@@ -28,14 +28,14 @@ declare module 'buffer' {
28
28
  /**
29
29
  * @default 'utf8'
30
30
  */
31
- encoding?: BufferEncoding;
31
+ encoding?: BufferEncoding | undefined;
32
32
 
33
33
  /**
34
34
  * The Blob content-type. The intent is for `type` to convey
35
35
  * the MIME media type of the data, however no validation of the type format
36
36
  * is performed.
37
37
  */
38
- type?: string;
38
+ type?: string | undefined;
39
39
  }
40
40
 
41
41
  /**
node/child_process.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare module 'child_process' {
2
- import { BaseEncodingOptions } from 'fs';
2
+ import { ObjectEncodingOptions } from 'fs';
3
3
  import { EventEmitter, Abortable } from 'events';
4
4
  import * as net from 'net';
5
5
  import { Writable, Readable, Stream, Pipe } from 'stream';
@@ -11,7 +11,7 @@ declare module 'child_process' {
11
11
  stdin: Writable | null;
12
12
  stdout: Readable | null;
13
13
  stderr: Readable | null;
14
- readonly channel?: Pipe | null;
14
+ readonly channel?: Pipe | null | undefined;
15
15
  readonly stdio: [
16
16
  Writable | null, // stdin
17
17
  Readable | null, // stdout
@@ -20,7 +20,7 @@ declare module 'child_process' {
20
20
  Readable | Writable | null | undefined // extra
21
21
  ];
22
22
  readonly killed: boolean;
23
- readonly pid?: number;
23
+ readonly pid?: number | undefined;
24
24
  readonly connected: boolean;
25
25
  readonly exitCode: number | null;
26
26
  readonly signalCode: NodeJS.Signals | null;
@@ -126,7 +126,7 @@ declare module 'child_process' {
126
126
  }
127
127
 
128
128
  interface MessageOptions {
129
- keepOpen?: boolean;
129
+ keepOpen?: boolean | undefined;
130
130
  }
131
131
 
132
132
  type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
@@ -140,51 +140,51 @@ declare module 'child_process' {
140
140
  * Specify the kind of serialization used for sending messages between processes.
141
141
  * @default 'json'
142
142
  */
143
- serialization?: SerializationType;
143
+ serialization?: SerializationType | undefined;
144
144
 
145
145
  /**
146
146
  * The signal value to be used when the spawned process will be killed by the abort signal.
147
147
  * @default 'SIGTERM'
148
148
  */
149
- killSignal?: NodeJS.Signals | number;
149
+ killSignal?: NodeJS.Signals | number | undefined;
150
150
 
151
151
  /**
152
152
  * In milliseconds the maximum amount of time the process is allowed to run.
153
153
  */
154
- timeout?: number;
154
+ timeout?: number | undefined;
155
155
  }
156
156
 
157
157
  interface ProcessEnvOptions {
158
- uid?: number;
159
- gid?: number;
160
- cwd?: string;
161
- env?: NodeJS.ProcessEnv;
158
+ uid?: number | undefined;
159
+ gid?: number | undefined;
160
+ cwd?: string | undefined;
161
+ env?: NodeJS.ProcessEnv | undefined;
162
162
  }
163
163
 
164
164
  interface CommonOptions extends ProcessEnvOptions {
165
165
  /**
166
166
  * @default true
167
167
  */
168
- windowsHide?: boolean;
168
+ windowsHide?: boolean | undefined;
169
169
  /**
170
170
  * @default 0
171
171
  */
172
- timeout?: number;
172
+ timeout?: number | undefined;
173
173
  }
174
174
 
175
175
  interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
176
- argv0?: string;
177
- stdio?: StdioOptions;
178
- shell?: boolean | string;
179
- windowsVerbatimArguments?: boolean;
176
+ argv0?: string | undefined;
177
+ stdio?: StdioOptions | undefined;
178
+ shell?: boolean | string | undefined;
179
+ windowsVerbatimArguments?: boolean | undefined;
180
180
  }
181
181
 
182
182
  interface SpawnOptions extends CommonSpawnOptions {
183
- detached?: boolean;
183
+ detached?: boolean | undefined;
184
184
  }
185
185
 
186
186
  interface SpawnOptionsWithoutStdio extends SpawnOptions {
187
- stdio?: StdioPipeNamed | StdioPipe[];
187
+ stdio?: StdioPipeNamed | StdioPipe[] | undefined;
188
188
  }
189
189
 
190
190
  type StdioNull = 'inherit' | 'ignore' | Stream;
@@ -284,9 +284,9 @@ declare module 'child_process' {
284
284
  function spawn(command: string, args: ReadonlyArray<string>, options: SpawnOptions): ChildProcess;
285
285
 
286
286
  interface ExecOptions extends CommonOptions {
287
- shell?: string;
288
- maxBuffer?: number;
289
- killSignal?: NodeJS.Signals | number;
287
+ shell?: string | undefined;
288
+ maxBuffer?: number | undefined;
289
+ killSignal?: NodeJS.Signals | number | undefined;
290
290
  }
291
291
 
292
292
  interface ExecOptionsWithStringEncoding extends ExecOptions {
@@ -298,10 +298,10 @@ declare module 'child_process' {
298
298
  }
299
299
 
300
300
  interface ExecException extends Error {
301
- cmd?: string;
302
- killed?: boolean;
303
- code?: number;
304
- signal?: NodeJS.Signals;
301
+ cmd?: string | undefined;
302
+ killed?: boolean | undefined;
303
+ code?: number | undefined;
304
+ signal?: NodeJS.Signals | undefined;
305
305
  }
306
306
 
307
307
  // no `options` definitely means stdout/stderr are `string`.
@@ -327,7 +327,7 @@ declare module 'child_process' {
327
327
  // fallback if nothing else matches. Worst case is always `string | Buffer`.
328
328
  function exec(
329
329
  command: string,
330
- options: (BaseEncodingOptions & ExecOptions) | undefined | null,
330
+ options: (ObjectEncodingOptions & ExecOptions) | undefined | null,
331
331
  callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
332
332
  ): ChildProcess;
333
333
 
@@ -341,15 +341,15 @@ declare module 'child_process' {
341
341
  function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
342
342
  function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
343
343
  function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
344
- function __promisify__(command: string, options?: (BaseEncodingOptions & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
344
+ function __promisify__(command: string, options?: (ObjectEncodingOptions & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
345
345
  }
346
346
 
347
347
  interface ExecFileOptions extends CommonOptions, Abortable {
348
- maxBuffer?: number;
349
- killSignal?: NodeJS.Signals | number;
350
- windowsVerbatimArguments?: boolean;
351
- shell?: boolean | string;
352
- signal?: AbortSignal;
348
+ maxBuffer?: number | undefined;
349
+ killSignal?: NodeJS.Signals | number | undefined;
350
+ windowsVerbatimArguments?: boolean | undefined;
351
+ shell?: boolean | string | undefined;
352
+ signal?: AbortSignal | undefined;
353
353
  }
354
354
  interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
355
355
  encoding: BufferEncoding;
@@ -363,9 +363,9 @@ declare module 'child_process' {
363
363
  type ExecFileException = ExecException & NodeJS.ErrnoException;
364
364
 
365
365
  function execFile(file: string): ChildProcess;
366
- function execFile(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
366
+ function execFile(file: string, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
367
367
  function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess;
368
- function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
368
+ function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
369
369
 
370
370
  // no `options` definitely means stdout/stderr are `string`.
371
371
  function execFile(file: string, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
@@ -415,13 +415,13 @@ declare module 'child_process' {
415
415
  // fallback if nothing else matches. Worst case is always `string | Buffer`.
416
416
  function execFile(
417
417
  file: string,
418
- options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
418
+ options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
419
419
  callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
420
420
  ): ChildProcess;
421
421
  function execFile(
422
422
  file: string,
423
423
  args: ReadonlyArray<string> | undefined | null,
424
- options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
424
+ options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
425
425
  callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
426
426
  ): ChildProcess;
427
427
 
@@ -441,35 +441,35 @@ declare module 'child_process' {
441
441
  ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
442
442
  function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
443
443
  function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
444
- function __promisify__(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
444
+ function __promisify__(file: string, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
445
445
  function __promisify__(
446
446
  file: string,
447
447
  args: ReadonlyArray<string> | undefined | null,
448
- options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
448
+ options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
449
449
  ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
450
450
  }
451
451
 
452
452
  interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
453
- execPath?: string;
454
- execArgv?: string[];
455
- silent?: boolean;
456
- stdio?: StdioOptions;
457
- detached?: boolean;
458
- windowsVerbatimArguments?: boolean;
453
+ execPath?: string | undefined;
454
+ execArgv?: string[] | undefined;
455
+ silent?: boolean | undefined;
456
+ stdio?: StdioOptions | undefined;
457
+ detached?: boolean | undefined;
458
+ windowsVerbatimArguments?: boolean | undefined;
459
459
  }
460
460
  function fork(modulePath: string, options?: ForkOptions): ChildProcess;
461
461
  function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
462
462
 
463
463
  interface SpawnSyncOptions extends CommonSpawnOptions {
464
- input?: string | NodeJS.ArrayBufferView;
465
- maxBuffer?: number;
466
- encoding?: BufferEncoding | 'buffer' | null;
464
+ input?: string | NodeJS.ArrayBufferView | undefined;
465
+ maxBuffer?: number | undefined;
466
+ encoding?: BufferEncoding | 'buffer' | null | undefined;
467
467
  }
468
468
  interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
469
469
  encoding: BufferEncoding;
470
470
  }
471
471
  interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
472
- encoding?: 'buffer' | null;
472
+ encoding?: 'buffer' | null | undefined;
473
473
  }
474
474
  interface SpawnSyncReturns<T> {
475
475
  pid: number;
@@ -478,7 +478,7 @@ declare module 'child_process' {
478
478
  stderr: T;
479
479
  status: number | null;
480
480
  signal: NodeJS.Signals | null;
481
- error?: Error;
481
+ error?: Error | undefined;
482
482
  }
483
483
  function spawnSync(command: string): SpawnSyncReturns<Buffer>;
484
484
  function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
@@ -489,21 +489,21 @@ declare module 'child_process' {
489
489
  function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
490
490
 
491
491
  interface CommonExecOptions extends ProcessEnvOptions {
492
- input?: string | NodeJS.ArrayBufferView;
493
- stdio?: StdioOptions;
494
- killSignal?: NodeJS.Signals | number;
495
- maxBuffer?: number;
496
- encoding?: BufferEncoding | 'buffer' | null;
492
+ input?: string | NodeJS.ArrayBufferView | undefined;
493
+ stdio?: StdioOptions | undefined;
494
+ killSignal?: NodeJS.Signals | number | undefined;
495
+ maxBuffer?: number | undefined;
496
+ encoding?: BufferEncoding | 'buffer' | null | undefined;
497
497
  }
498
498
 
499
499
  interface ExecSyncOptions extends CommonExecOptions {
500
- shell?: string;
500
+ shell?: string | undefined;
501
501
  }
502
502
  interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
503
503
  encoding: BufferEncoding;
504
504
  }
505
505
  interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
506
- encoding?: 'buffer' | null;
506
+ encoding?: 'buffer' | null | undefined;
507
507
  }
508
508
  function execSync(command: string): Buffer;
509
509
  function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
@@ -511,7 +511,7 @@ declare module 'child_process' {
511
511
  function execSync(command: string, options?: ExecSyncOptions): Buffer;
512
512
 
513
513
  interface ExecFileSyncOptions extends CommonExecOptions {
514
- shell?: boolean | string;
514
+ shell?: boolean | string | undefined;
515
515
  }
516
516
  interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
517
517
  encoding: BufferEncoding;
node/cluster.d.ts CHANGED
@@ -5,14 +5,14 @@ declare module 'cluster' {
5
5
  import * as net from 'net';
6
6
 
7
7
  export interface ClusterSettings {
8
- execArgv?: string[]; // default: process.execArgv
9
- exec?: string;
10
- args?: string[];
11
- silent?: boolean;
12
- stdio?: any[];
13
- uid?: number;
14
- gid?: number;
15
- inspectPort?: number | (() => number);
8
+ execArgv?: string[] | undefined; // default: process.execArgv
9
+ exec?: string | undefined;
10
+ args?: string[] | undefined;
11
+ silent?: boolean | undefined;
12
+ stdio?: any[] | undefined;
13
+ uid?: number | undefined;
14
+ gid?: number | undefined;
15
+ inspectPort?: number | (() => number) | undefined;
16
16
  }
17
17
 
18
18
  export interface Address {
@@ -105,8 +105,8 @@ declare module 'cluster' {
105
105
  * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings.
106
106
  */
107
107
  setupPrimary(settings?: ClusterSettings): void;
108
- readonly worker?: Worker;
109
- readonly workers?: NodeJS.Dict<Worker>;
108
+ readonly worker?: Worker | undefined;
109
+ readonly workers?: NodeJS.Dict<Worker> | undefined;
110
110
 
111
111
  readonly SCHED_NONE: number;
112
112
  readonly SCHED_RR: number;
node/console.d.ts CHANGED
@@ -109,10 +109,10 @@ declare module 'console' {
109
109
  namespace console {
110
110
  interface ConsoleConstructorOptions {
111
111
  stdout: NodeJS.WritableStream;
112
- stderr?: NodeJS.WritableStream;
113
- ignoreErrors?: boolean;
114
- colorMode?: boolean | 'auto';
115
- inspectOptions?: InspectOptions;
112
+ stderr?: NodeJS.WritableStream | undefined;
113
+ ignoreErrors?: boolean | undefined;
114
+ colorMode?: boolean | 'auto' | undefined;
115
+ inspectOptions?: InspectOptions | undefined;
116
116
  }
117
117
 
118
118
  interface ConsoleConstructor {