@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/util.d.ts CHANGED
@@ -10,24 +10,24 @@ declare module 'util' {
10
10
  * the getter function.
11
11
  * @default `false`
12
12
  */
13
- getters?: 'get' | 'set' | boolean;
14
- showHidden?: boolean;
13
+ getters?: 'get' | 'set' | boolean | undefined;
14
+ showHidden?: boolean | undefined;
15
15
  /**
16
16
  * @default 2
17
17
  */
18
- depth?: number | null;
19
- colors?: boolean;
20
- customInspect?: boolean;
21
- showProxy?: boolean;
22
- maxArrayLength?: number | null;
18
+ depth?: number | null | undefined;
19
+ colors?: boolean | undefined;
20
+ customInspect?: boolean | undefined;
21
+ showProxy?: boolean | undefined;
22
+ maxArrayLength?: number | null | undefined;
23
23
  /**
24
24
  * Specifies the maximum number of characters to
25
25
  * include when formatting. Set to `null` or `Infinity` to show all elements.
26
26
  * Set to `0` or negative to show no characters.
27
27
  * @default 10000
28
28
  */
29
- maxStringLength?: number | null;
30
- breakLength?: number;
29
+ maxStringLength?: number | null | undefined;
30
+ breakLength?: number | undefined;
31
31
  /**
32
32
  * Setting this to `false` causes each object key
33
33
  * to be displayed on a new line. It will also add new lines to text that is
@@ -38,8 +38,8 @@ declare module 'util' {
38
38
  * For more information, see the example below.
39
39
  * @default `true`
40
40
  */
41
- compact?: boolean | number;
42
- sorted?: boolean | ((a: string, b: string) => number);
41
+ compact?: boolean | number | undefined;
42
+ sorted?: boolean | ((a: string, b: string) => number) | undefined;
43
43
  }
44
44
 
45
45
  export type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module';
@@ -168,11 +168,11 @@ declare module 'util' {
168
168
  readonly ignoreBOM: boolean;
169
169
  constructor(
170
170
  encoding?: string,
171
- options?: { fatal?: boolean; ignoreBOM?: boolean }
171
+ options?: { fatal?: boolean | undefined; ignoreBOM?: boolean | undefined }
172
172
  );
173
173
  decode(
174
174
  input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
175
- options?: { stream?: boolean }
175
+ options?: { stream?: boolean | undefined }
176
176
  ): string;
177
177
  }
178
178
 
@@ -200,3 +200,65 @@ declare module 'util' {
200
200
  declare module 'node:util' {
201
201
  export * from 'util';
202
202
  }
203
+
204
+ declare module 'util/types' {
205
+ import { KeyObject, webcrypto } from 'crypto';
206
+
207
+ function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike;
208
+ function isArgumentsObject(object: unknown): object is IArguments;
209
+ function isArrayBuffer(object: unknown): object is ArrayBuffer;
210
+ function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView;
211
+ function isAsyncFunction(object: unknown): boolean;
212
+ function isBigInt64Array(value: unknown): value is BigInt64Array;
213
+ function isBigUint64Array(value: unknown): value is BigUint64Array;
214
+ function isBooleanObject(object: unknown): object is Boolean;
215
+ function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol;
216
+ function isDataView(object: unknown): object is DataView;
217
+ function isDate(object: unknown): object is Date;
218
+ function isExternal(object: unknown): boolean;
219
+ function isFloat32Array(object: unknown): object is Float32Array;
220
+ function isFloat64Array(object: unknown): object is Float64Array;
221
+ function isGeneratorFunction(object: unknown): object is GeneratorFunction;
222
+ function isGeneratorObject(object: unknown): object is Generator;
223
+ function isInt8Array(object: unknown): object is Int8Array;
224
+ function isInt16Array(object: unknown): object is Int16Array;
225
+ function isInt32Array(object: unknown): object is Int32Array;
226
+ function isMap<T>(
227
+ object: T | {},
228
+ ): object is T extends ReadonlyMap<any, any>
229
+ ? unknown extends T
230
+ ? never
231
+ : ReadonlyMap<any, any>
232
+ : Map<unknown, unknown>;
233
+ function isMapIterator(object: unknown): boolean;
234
+ function isModuleNamespaceObject(value: unknown): boolean;
235
+ function isNativeError(object: unknown): object is Error;
236
+ function isNumberObject(object: unknown): object is Number;
237
+ function isPromise(object: unknown): object is Promise<unknown>;
238
+ function isProxy(object: unknown): boolean;
239
+ function isRegExp(object: unknown): object is RegExp;
240
+ function isSet<T>(
241
+ object: T | {},
242
+ ): object is T extends ReadonlySet<any>
243
+ ? unknown extends T
244
+ ? never
245
+ : ReadonlySet<any>
246
+ : Set<unknown>;
247
+ function isSetIterator(object: unknown): boolean;
248
+ function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer;
249
+ function isStringObject(object: unknown): object is String;
250
+ function isSymbolObject(object: unknown): object is Symbol;
251
+ function isTypedArray(object: unknown): object is NodeJS.TypedArray;
252
+ function isUint8Array(object: unknown): object is Uint8Array;
253
+ function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray;
254
+ function isUint16Array(object: unknown): object is Uint16Array;
255
+ function isUint32Array(object: unknown): object is Uint32Array;
256
+ function isWeakMap(object: unknown): object is WeakMap<object, unknown>;
257
+ function isWeakSet(object: unknown): object is WeakSet<object>;
258
+ function isKeyObject(object: unknown): object is KeyObject;
259
+ function isCryptoKey(object: unknown): object is webcrypto.CryptoKey;
260
+ }
261
+
262
+ declare module 'node:util/types' {
263
+ export * from 'util/types';
264
+ }
node/vm.d.ts CHANGED
@@ -5,67 +5,67 @@ declare module 'vm' {
5
5
  * Specifies the filename used in stack traces produced by this script.
6
6
  * Default: `''`.
7
7
  */
8
- filename?: string;
8
+ filename?: string | undefined;
9
9
  /**
10
10
  * Specifies the line number offset that is displayed in stack traces produced by this script.
11
11
  * Default: `0`.
12
12
  */
13
- lineOffset?: number;
13
+ lineOffset?: number | undefined;
14
14
  /**
15
15
  * Specifies the column number offset that is displayed in stack traces produced by this script.
16
16
  * @default 0
17
17
  */
18
- columnOffset?: number;
18
+ columnOffset?: number | undefined;
19
19
  }
20
20
  interface ScriptOptions extends BaseOptions {
21
- displayErrors?: boolean;
22
- timeout?: number;
23
- cachedData?: Buffer;
21
+ displayErrors?: boolean | undefined;
22
+ timeout?: number | undefined;
23
+ cachedData?: Buffer | undefined;
24
24
  /** @deprecated in favor of `script.createCachedData()` */
25
- produceCachedData?: boolean;
25
+ produceCachedData?: boolean | undefined;
26
26
  }
27
27
  interface RunningScriptOptions extends BaseOptions {
28
28
  /**
29
29
  * When `true`, if an `Error` occurs while compiling the `code`, the line of code causing the error is attached to the stack trace.
30
30
  * Default: `true`.
31
31
  */
32
- displayErrors?: boolean;
32
+ displayErrors?: boolean | undefined;
33
33
  /**
34
34
  * Specifies the number of milliseconds to execute code before terminating execution.
35
35
  * If execution is terminated, an `Error` will be thrown. This value must be a strictly positive integer.
36
36
  */
37
- timeout?: number;
37
+ timeout?: number | undefined;
38
38
  /**
39
39
  * If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received.
40
40
  * Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled during script execution, but will continue to work after that.
41
41
  * If execution is terminated, an `Error` will be thrown.
42
42
  * Default: `false`.
43
43
  */
44
- breakOnSigint?: boolean;
44
+ breakOnSigint?: boolean | undefined;
45
45
  /**
46
46
  * If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
47
47
  */
48
- microtaskMode?: 'afterEvaluate';
48
+ microtaskMode?: 'afterEvaluate' | undefined;
49
49
  }
50
50
  interface CompileFunctionOptions extends BaseOptions {
51
51
  /**
52
52
  * Provides an optional data with V8's code cache data for the supplied source.
53
53
  */
54
- cachedData?: Buffer;
54
+ cachedData?: Buffer | undefined;
55
55
  /**
56
56
  * Specifies whether to produce new cache data.
57
57
  * Default: `false`,
58
58
  */
59
- produceCachedData?: boolean;
59
+ produceCachedData?: boolean | undefined;
60
60
  /**
61
61
  * The sandbox/context in which the said function should be compiled in.
62
62
  */
63
- parsingContext?: Context;
63
+ parsingContext?: Context | undefined;
64
64
 
65
65
  /**
66
66
  * An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling
67
67
  */
68
- contextExtensions?: Object[];
68
+ contextExtensions?: Object[] | undefined;
69
69
  }
70
70
 
71
71
  interface CreateContextOptions {
@@ -73,7 +73,7 @@ declare module 'vm' {
73
73
  * Human-readable name of the newly created context.
74
74
  * @default 'VM Context i' Where i is an ascending numerical index of the created context.
75
75
  */
76
- name?: string;
76
+ name?: string | undefined;
77
77
  /**
78
78
  * Corresponds to the newly created context for display purposes.
79
79
  * The origin should be formatted like a `URL`, but with only the scheme, host, and port (if necessary),
@@ -81,24 +81,24 @@ declare module 'vm' {
81
81
  * Most notably, this string should omit the trailing slash, as that denotes a path.
82
82
  * @default ''
83
83
  */
84
- origin?: string;
84
+ origin?: string | undefined;
85
85
  codeGeneration?: {
86
86
  /**
87
87
  * If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc)
88
88
  * will throw an EvalError.
89
89
  * @default true
90
90
  */
91
- strings?: boolean;
91
+ strings?: boolean | undefined;
92
92
  /**
93
93
  * If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError.
94
94
  * @default true
95
95
  */
96
- wasm?: boolean;
97
- };
96
+ wasm?: boolean | undefined;
97
+ } | undefined;
98
98
  /**
99
99
  * If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
100
100
  */
101
- microtaskMode?: 'afterEvaluate';
101
+ microtaskMode?: 'afterEvaluate' | undefined;
102
102
  }
103
103
 
104
104
  type MeasureMemoryMode = 'summary' | 'detailed';
@@ -107,8 +107,8 @@ declare module 'vm' {
107
107
  /**
108
108
  * @default 'summary'
109
109
  */
110
- mode?: MeasureMemoryMode;
111
- context?: Context;
110
+ mode?: MeasureMemoryMode | undefined;
111
+ context?: Context | undefined;
112
112
  }
113
113
 
114
114
  interface MemoryMeasurement {
@@ -124,7 +124,7 @@ declare module 'vm' {
124
124
  runInNewContext(sandbox?: Context, options?: RunningScriptOptions): any;
125
125
  runInThisContext(options?: RunningScriptOptions): any;
126
126
  createCachedData(): Buffer;
127
- cachedDataRejected?: boolean;
127
+ cachedDataRejected?: boolean | undefined;
128
128
  }
129
129
  function createContext(sandbox?: Context, options?: CreateContextOptions): Context;
130
130
  function isContext(sandbox: Context): boolean;
node/wasi.d.ts CHANGED
@@ -5,13 +5,13 @@ declare module 'wasi' {
5
5
  * see as command line arguments. The first argument is the virtual path to the
6
6
  * WASI command itself.
7
7
  */
8
- args?: string[];
8
+ args?: string[] | undefined;
9
9
 
10
10
  /**
11
11
  * An object similar to `process.env` that the WebAssembly
12
12
  * application will see as its environment.
13
13
  */
14
- env?: object;
14
+ env?: object | undefined;
15
15
 
16
16
  /**
17
17
  * This object represents the WebAssembly application's
@@ -19,7 +19,7 @@ declare module 'wasi' {
19
19
  * directories within the sandbox. The corresponding values in `preopens` are
20
20
  * the real paths to those directories on the host machine.
21
21
  */
22
- preopens?: NodeJS.Dict<string>;
22
+ preopens?: NodeJS.Dict<string> | undefined;
23
23
 
24
24
  /**
25
25
  * By default, WASI applications terminate the Node.js
@@ -28,25 +28,25 @@ declare module 'wasi' {
28
28
  * process.
29
29
  * @default false
30
30
  */
31
- returnOnExit?: boolean;
31
+ returnOnExit?: boolean | undefined;
32
32
 
33
33
  /**
34
34
  * The file descriptor used as standard input in the WebAssembly application.
35
35
  * @default 0
36
36
  */
37
- stdin?: number;
37
+ stdin?: number | undefined;
38
38
 
39
39
  /**
40
40
  * The file descriptor used as standard output in the WebAssembly application.
41
41
  * @default 1
42
42
  */
43
- stdout?: number;
43
+ stdout?: number | undefined;
44
44
 
45
45
  /**
46
46
  * The file descriptor used as standard error in the WebAssembly application.
47
47
  * @default 2
48
48
  */
49
- stderr?: number;
49
+ stderr?: number | undefined;
50
50
  }
51
51
 
52
52
  class WASI {
node/worker_threads.d.ts CHANGED
@@ -81,43 +81,43 @@ declare module 'worker_threads' {
81
81
  * but the values will be available on the global `process.argv` as if they
82
82
  * were passed as CLI options to the script.
83
83
  */
84
- argv?: any[];
85
- env?: NodeJS.Dict<string> | typeof SHARE_ENV;
86
- eval?: boolean;
84
+ argv?: any[] | undefined;
85
+ env?: NodeJS.Dict<string> | typeof SHARE_ENV | undefined;
86
+ eval?: boolean | undefined;
87
87
  workerData?: any;
88
- stdin?: boolean;
89
- stdout?: boolean;
90
- stderr?: boolean;
91
- execArgv?: string[];
92
- resourceLimits?: ResourceLimits;
88
+ stdin?: boolean | undefined;
89
+ stdout?: boolean | undefined;
90
+ stderr?: boolean | undefined;
91
+ execArgv?: string[] | undefined;
92
+ resourceLimits?: ResourceLimits | undefined;
93
93
  /**
94
94
  * Additional data to send in the first worker message.
95
95
  */
96
- transferList?: TransferListItem[];
96
+ transferList?: TransferListItem[] | undefined;
97
97
  /**
98
98
  * @default true
99
99
  */
100
- trackUnmanagedFds?: boolean;
100
+ trackUnmanagedFds?: boolean | undefined;
101
101
  }
102
102
 
103
103
  interface ResourceLimits {
104
104
  /**
105
105
  * The maximum size of a heap space for recently created objects.
106
106
  */
107
- maxYoungGenerationSizeMb?: number;
107
+ maxYoungGenerationSizeMb?: number | undefined;
108
108
  /**
109
109
  * The maximum size of the main heap in MB.
110
110
  */
111
- maxOldGenerationSizeMb?: number;
111
+ maxOldGenerationSizeMb?: number | undefined;
112
112
  /**
113
113
  * The size of a pre-allocated memory range used for generated code.
114
114
  */
115
- codeRangeSizeMb?: number;
115
+ codeRangeSizeMb?: number | undefined;
116
116
  /**
117
117
  * The default maximum stack size for the thread. Small values may lead to unusable Worker instances.
118
118
  * @default 4
119
119
  */
120
- stackSizeMb?: number;
120
+ stackSizeMb?: number | undefined;
121
121
  }
122
122
 
123
123
  class Worker extends EventEmitter {
@@ -125,7 +125,7 @@ declare module 'worker_threads' {
125
125
  readonly stdout: Readable;
126
126
  readonly stderr: Readable;
127
127
  readonly threadId: number;
128
- readonly resourceLimits?: ResourceLimits;
128
+ readonly resourceLimits?: ResourceLimits | undefined;
129
129
  readonly performance: WorkerPerformance;
130
130
 
131
131
  /**
node/zlib.d.ts CHANGED
@@ -5,51 +5,51 @@ declare module 'zlib' {
5
5
  /**
6
6
  * @default constants.Z_NO_FLUSH
7
7
  */
8
- flush?: number;
8
+ flush?: number | undefined;
9
9
  /**
10
10
  * @default constants.Z_FINISH
11
11
  */
12
- finishFlush?: number;
12
+ finishFlush?: number | undefined;
13
13
  /**
14
14
  * @default 16*1024
15
15
  */
16
- chunkSize?: number;
17
- windowBits?: number;
18
- level?: number; // compression only
19
- memLevel?: number; // compression only
20
- strategy?: number; // compression only
21
- dictionary?: NodeJS.ArrayBufferView | ArrayBuffer; // deflate/inflate only, empty dictionary by default
22
- info?: boolean;
23
- maxOutputLength?: number;
16
+ chunkSize?: number | undefined;
17
+ windowBits?: number | undefined;
18
+ level?: number | undefined; // compression only
19
+ memLevel?: number | undefined; // compression only
20
+ strategy?: number | undefined; // compression only
21
+ dictionary?: NodeJS.ArrayBufferView | ArrayBuffer | undefined; // deflate/inflate only, empty dictionary by default
22
+ info?: boolean | undefined;
23
+ maxOutputLength?: number | undefined;
24
24
  }
25
25
 
26
26
  interface BrotliOptions {
27
27
  /**
28
28
  * @default constants.BROTLI_OPERATION_PROCESS
29
29
  */
30
- flush?: number;
30
+ flush?: number | undefined;
31
31
  /**
32
32
  * @default constants.BROTLI_OPERATION_FINISH
33
33
  */
34
- finishFlush?: number;
34
+ finishFlush?: number | undefined;
35
35
  /**
36
36
  * @default 16*1024
37
37
  */
38
- chunkSize?: number;
38
+ chunkSize?: number | undefined;
39
39
  params?: {
40
40
  /**
41
41
  * Each key is a `constants.BROTLI_*` constant.
42
42
  */
43
43
  [key: number]: boolean | number;
44
- };
45
- maxOutputLength?: number;
44
+ } | undefined;
45
+ maxOutputLength?: number | undefined;
46
46
  }
47
47
 
48
48
  interface Zlib {
49
49
  /** @deprecated Use bytesWritten instead. */
50
50
  readonly bytesRead: number;
51
51
  readonly bytesWritten: number;
52
- shell?: boolean | string;
52
+ shell?: boolean | string | undefined;
53
53
  close(callback?: () => void): void;
54
54
  flush(kind?: number, callback?: () => void): void;
55
55
  flush(callback?: () => void): void;
node/util/types.d.ts DELETED
@@ -1,57 +0,0 @@
1
- declare module 'util/types' {
2
- function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike;
3
- function isArgumentsObject(object: unknown): object is IArguments;
4
- function isArrayBuffer(object: unknown): object is ArrayBuffer;
5
- function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView;
6
- function isAsyncFunction(object: unknown): boolean;
7
- function isBigInt64Array(value: unknown): value is BigInt64Array;
8
- function isBigUint64Array(value: unknown): value is BigUint64Array;
9
- function isBooleanObject(object: unknown): object is Boolean;
10
- function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol;
11
- function isDataView(object: unknown): object is DataView;
12
- function isDate(object: unknown): object is Date;
13
- function isExternal(object: unknown): boolean;
14
- function isFloat32Array(object: unknown): object is Float32Array;
15
- function isFloat64Array(object: unknown): object is Float64Array;
16
- function isGeneratorFunction(object: unknown): object is GeneratorFunction;
17
- function isGeneratorObject(object: unknown): object is Generator;
18
- function isInt8Array(object: unknown): object is Int8Array;
19
- function isInt16Array(object: unknown): object is Int16Array;
20
- function isInt32Array(object: unknown): object is Int32Array;
21
- function isMap<T>(
22
- object: T | {},
23
- ): object is T extends ReadonlyMap<any, any>
24
- ? unknown extends T
25
- ? never
26
- : ReadonlyMap<any, any>
27
- : Map<unknown, unknown>;
28
- function isMapIterator(object: unknown): boolean;
29
- function isModuleNamespaceObject(value: unknown): boolean;
30
- function isNativeError(object: unknown): object is Error;
31
- function isNumberObject(object: unknown): object is Number;
32
- function isPromise(object: unknown): object is Promise<unknown>;
33
- function isProxy(object: unknown): boolean;
34
- function isRegExp(object: unknown): object is RegExp;
35
- function isSet<T>(
36
- object: T | {},
37
- ): object is T extends ReadonlySet<any>
38
- ? unknown extends T
39
- ? never
40
- : ReadonlySet<any>
41
- : Set<unknown>;
42
- function isSetIterator(object: unknown): boolean;
43
- function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer;
44
- function isStringObject(object: unknown): object is String;
45
- function isSymbolObject(object: unknown): object is Symbol;
46
- function isTypedArray(object: unknown): object is NodeJS.TypedArray;
47
- function isUint8Array(object: unknown): object is Uint8Array;
48
- function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray;
49
- function isUint16Array(object: unknown): object is Uint16Array;
50
- function isUint32Array(object: unknown): object is Uint32Array;
51
- function isWeakMap(object: unknown): object is WeakMap<object, unknown>;
52
- function isWeakSet(object: unknown): object is WeakSet<object>;
53
- }
54
-
55
- declare module 'node:util/types' {
56
- export * from 'util/types';
57
- }