@types/node 16.0.0 → 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.
node/dns.d.ts CHANGED
@@ -11,14 +11,14 @@ declare module 'dns' {
11
11
  export const ALL: number;
12
12
 
13
13
  export interface LookupOptions {
14
- family?: number;
15
- hints?: number;
16
- all?: boolean;
17
- verbatim?: boolean;
14
+ family?: number | undefined;
15
+ hints?: number | undefined;
16
+ all?: boolean | undefined;
17
+ verbatim?: boolean | undefined;
18
18
  }
19
19
 
20
20
  export interface LookupOneOptions extends LookupOptions {
21
- all?: false;
21
+ all?: false | undefined;
22
22
  }
23
23
 
24
24
  export interface LookupAllOptions extends LookupOptions {
@@ -75,11 +75,11 @@ declare module 'dns' {
75
75
 
76
76
  export interface CaaRecord {
77
77
  critial: number;
78
- issue?: string;
79
- issuewild?: string;
80
- iodef?: string;
81
- contactemail?: string;
82
- contactphone?: string;
78
+ issue?: string | undefined;
79
+ issuewild?: string | undefined;
80
+ iodef?: string | undefined;
81
+ contactemail?: string | undefined;
82
+ contactphone?: string | undefined;
83
83
  }
84
84
 
85
85
  export interface MxRecord {
@@ -293,7 +293,7 @@ declare module 'dns' {
293
293
  export const CANCELLED: string;
294
294
 
295
295
  export interface ResolverOptions {
296
- timeout?: number;
296
+ timeout?: number | undefined;
297
297
  }
298
298
 
299
299
  export class Resolver {
node/events.d.ts CHANGED
@@ -3,7 +3,7 @@ declare module 'events' {
3
3
  /**
4
4
  * Enables automatic capturing of promise rejection.
5
5
  */
6
- captureRejections?: boolean;
6
+ captureRejections?: boolean | undefined;
7
7
  }
8
8
 
9
9
  interface NodeEventTarget {
@@ -15,7 +15,7 @@ declare module 'events' {
15
15
  }
16
16
 
17
17
  interface StaticEventEmitterOptions {
18
- signal?: AbortSignal;
18
+ signal?: AbortSignal | undefined;
19
19
  }
20
20
 
21
21
  interface EventEmitter extends NodeJS.EventEmitter {}
@@ -62,7 +62,7 @@ declare module 'events' {
62
62
  /**
63
63
  * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
64
64
  */
65
- signal?: AbortSignal;
65
+ signal?: AbortSignal | undefined;
66
66
  }
67
67
  }
68
68
 
node/fs/promises.d.ts CHANGED
@@ -37,7 +37,7 @@ declare module 'fs/promises' {
37
37
  * If `mode` is a string, it is parsed as an octal integer.
38
38
  * If `flag` is not supplied, the default of `'a'` is used.
39
39
  */
40
- appendFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
40
+ appendFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null): Promise<void>;
41
41
 
42
42
  /**
43
43
  * Asynchronous fchown(2) - Change ownership of a file.
@@ -76,7 +76,7 @@ declare module 'fs/promises' {
76
76
  * @param options An object that may contain an optional flag.
77
77
  * If a flag is not provided, it defaults to `'r'`.
78
78
  */
79
- readFile(options?: { encoding?: null, flag?: OpenMode } | null): Promise<Buffer>;
79
+ readFile(options?: { encoding?: null | undefined, flag?: OpenMode | undefined } | null): Promise<Buffer>;
80
80
 
81
81
  /**
82
82
  * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
@@ -84,7 +84,7 @@ declare module 'fs/promises' {
84
84
  * @param options An object that may contain an optional flag.
85
85
  * If a flag is not provided, it defaults to `'r'`.
86
86
  */
87
- readFile(options: { encoding: BufferEncoding, flag?: OpenMode } | BufferEncoding): Promise<string>;
87
+ readFile(options: { encoding: BufferEncoding, flag?: OpenMode | undefined } | BufferEncoding): Promise<string>;
88
88
 
89
89
  /**
90
90
  * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
@@ -92,12 +92,12 @@ declare module 'fs/promises' {
92
92
  * @param options An object that may contain an optional flag.
93
93
  * If a flag is not provided, it defaults to `'r'`.
94
94
  */
95
- readFile(options?: BaseEncodingOptions & { flag?: OpenMode } | BufferEncoding | null): Promise<string | Buffer>;
95
+ readFile(options?: BaseEncodingOptions & { flag?: OpenMode | undefined } | BufferEncoding | null): Promise<string | Buffer>;
96
96
 
97
97
  /**
98
98
  * Asynchronous fstat(2) - Get file status.
99
99
  */
100
- stat(opts?: StatOptions & { bigint?: false }): Promise<Stats>;
100
+ stat(opts?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
101
101
  stat(opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
102
102
  stat(opts?: StatOptions): Promise<Stats | BigIntStats>;
103
103
 
@@ -146,7 +146,7 @@ declare module 'fs/promises' {
146
146
  * If `mode` is a string, it is parsed as an octal integer.
147
147
  * If `flag` is not supplied, the default of `'w'` is used.
148
148
  */
149
- writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } & Abortable | BufferEncoding | null): Promise<void>;
149
+ writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } & Abortable | BufferEncoding | null): Promise<void>;
150
150
 
151
151
  /**
152
152
  * See `fs.writev` promisified version.
@@ -296,7 +296,7 @@ declare module 'fs/promises' {
296
296
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
297
297
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
298
298
  */
299
- function mkdir(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise<void>;
299
+ function mkdir(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null): Promise<void>;
300
300
 
301
301
  /**
302
302
  * Asynchronous mkdir(2) - create a directory.
@@ -311,21 +311,21 @@ declare module 'fs/promises' {
311
311
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
312
312
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
313
313
  */
314
- function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
314
+ function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[]>;
315
315
 
316
316
  /**
317
317
  * Asynchronous readdir(3) - read a directory.
318
318
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
319
319
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
320
320
  */
321
- function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Promise<Buffer[]>;
321
+ function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer"): Promise<Buffer[]>;
322
322
 
323
323
  /**
324
324
  * Asynchronous readdir(3) - read a directory.
325
325
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
326
326
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
327
327
  */
328
- function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise<string[] | Buffer[]>;
328
+ function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[] | Buffer[]>;
329
329
 
330
330
  /**
331
331
  * Asynchronous readdir(3) - read a directory.
@@ -368,7 +368,7 @@ declare module 'fs/promises' {
368
368
  * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
369
369
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
370
370
  */
371
- function lstat(path: PathLike, opts?: StatOptions & { bigint?: false }): Promise<Stats>;
371
+ function lstat(path: PathLike, opts?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
372
372
  function lstat(path: PathLike, opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
373
373
  function lstat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
374
374
 
@@ -376,7 +376,7 @@ declare module 'fs/promises' {
376
376
  * Asynchronous stat(2) - Get file status.
377
377
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
378
378
  */
379
- function stat(path: PathLike, opts?: StatOptions & { bigint?: false }): Promise<Stats>;
379
+ function stat(path: PathLike, opts?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
380
380
  function stat(path: PathLike, opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
381
381
  function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
382
382
 
@@ -516,7 +516,7 @@ declare module 'fs/promises' {
516
516
  function writeFile(
517
517
  path: PathLike | FileHandle,
518
518
  data: string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | Stream,
519
- options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } & Abortable | BufferEncoding | null
519
+ options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } & Abortable | BufferEncoding | null
520
520
  ): Promise<void>;
521
521
 
522
522
  /**
@@ -531,7 +531,11 @@ declare module 'fs/promises' {
531
531
  * If `mode` is a string, it is parsed as an octal integer.
532
532
  * If `flag` is not supplied, the default of `'a'` is used.
533
533
  */
534
- function appendFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
534
+ function appendFile(
535
+ path: PathLike | FileHandle,
536
+ data: string | Uint8Array,
537
+ options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null
538
+ ): Promise<void>;
535
539
 
536
540
  /**
537
541
  * Asynchronously reads the entire contents of a file.
@@ -540,7 +544,7 @@ declare module 'fs/promises' {
540
544
  * @param options An object that may contain an optional flag.
541
545
  * If a flag is not provided, it defaults to `'r'`.
542
546
  */
543
- function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: OpenMode } & Abortable | null): Promise<Buffer>;
547
+ function readFile(path: PathLike | FileHandle, options?: { encoding?: null | undefined, flag?: OpenMode | undefined } & Abortable | null): Promise<Buffer>;
544
548
 
545
549
  /**
546
550
  * Asynchronously reads the entire contents of a file.
@@ -549,7 +553,7 @@ declare module 'fs/promises' {
549
553
  * @param options An object that may contain an optional flag.
550
554
  * If a flag is not provided, it defaults to `'r'`.
551
555
  */
552
- function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode } & Abortable | BufferEncoding): Promise<string>;
556
+ function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode | undefined } & Abortable | BufferEncoding): Promise<string>;
553
557
 
554
558
  /**
555
559
  * Asynchronously reads the entire contents of a file.
@@ -558,7 +562,7 @@ declare module 'fs/promises' {
558
562
  * @param options An object that may contain an optional flag.
559
563
  * If a flag is not provided, it defaults to `'r'`.
560
564
  */
561
- function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & Abortable & { flag?: OpenMode } | BufferEncoding | null): Promise<string | Buffer>;
565
+ function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & Abortable & { flag?: OpenMode | undefined } | BufferEncoding | null): Promise<string | Buffer>;
562
566
 
563
567
  function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
564
568
 
node/fs.d.ts CHANGED
@@ -15,7 +15,7 @@ declare module 'fs' {
15
15
  export type BufferEncodingOption = 'buffer' | { encoding: 'buffer' };
16
16
 
17
17
  export interface BaseEncodingOptions {
18
- encoding?: BufferEncoding | null;
18
+ encoding?: BufferEncoding | null | undefined;
19
19
  }
20
20
 
21
21
  export type OpenMode = number | string;
@@ -532,7 +532,7 @@ declare module 'fs' {
532
532
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
533
533
  */
534
534
  export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
535
- export function stat(path: PathLike, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
535
+ export function stat(path: PathLike, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
536
536
  export function stat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
537
537
  export function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
538
538
 
@@ -542,18 +542,18 @@ declare module 'fs' {
542
542
  * Asynchronous stat(2) - Get file status.
543
543
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
544
544
  */
545
- function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false }): Promise<Stats>;
545
+ function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
546
546
  function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
547
547
  function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
548
548
  }
549
549
 
550
550
  export interface StatSyncFn<TDescriptor = PathLike> extends Function {
551
551
  (path: TDescriptor, options?: undefined): Stats;
552
- (path: TDescriptor, options?: StatOptions & { bigint?: false; throwIfNoEntry: false }): Stats | undefined;
552
+ (path: TDescriptor, options?: StatOptions & { bigint?: false | undefined; throwIfNoEntry: false }): Stats | undefined;
553
553
  (path: TDescriptor, options: StatOptions & { bigint: true; throwIfNoEntry: false }): BigIntStats | undefined;
554
- (path: TDescriptor, options?: StatOptions & { bigint?: false }): Stats;
554
+ (path: TDescriptor, options?: StatOptions & { bigint?: false | undefined }): Stats;
555
555
  (path: TDescriptor, options: StatOptions & { bigint: true }): BigIntStats;
556
- (path: TDescriptor, options: StatOptions & { bigint: boolean; throwIfNoEntry?: false }): Stats | BigIntStats;
556
+ (path: TDescriptor, options: StatOptions & { bigint: boolean; throwIfNoEntry?: false | undefined }): Stats | BigIntStats;
557
557
  (path: TDescriptor, options?: StatOptions): Stats | BigIntStats | undefined;
558
558
  }
559
559
 
@@ -568,7 +568,7 @@ declare module 'fs' {
568
568
  * @param fd A file descriptor.
569
569
  */
570
570
  export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
571
- export function fstat(fd: number, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
571
+ export function fstat(fd: number, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
572
572
  export function fstat(fd: number, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
573
573
  export function fstat(fd: number, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
574
574
 
@@ -578,7 +578,7 @@ declare module 'fs' {
578
578
  * Asynchronous fstat(2) - Get file status.
579
579
  * @param fd A file descriptor.
580
580
  */
581
- function __promisify__(fd: number, options?: StatOptions & { bigint?: false }): Promise<Stats>;
581
+ function __promisify__(fd: number, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
582
582
  function __promisify__(fd: number, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
583
583
  function __promisify__(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
584
584
  }
@@ -594,7 +594,7 @@ declare module 'fs' {
594
594
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
595
595
  */
596
596
  export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
597
- export function lstat(path: PathLike, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
597
+ export function lstat(path: PathLike, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
598
598
  export function lstat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
599
599
  export function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
600
600
 
@@ -604,7 +604,7 @@ declare module 'fs' {
604
604
  * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
605
605
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
606
606
  */
607
- function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false }): Promise<Stats>;
607
+ function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
608
608
  function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
609
609
  function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
610
610
  }
@@ -874,13 +874,13 @@ declare module 'fs' {
874
874
  * `true`.
875
875
  * @default 0
876
876
  */
877
- maxRetries?: number;
877
+ maxRetries?: number | undefined;
878
878
  /**
879
879
  * The amount of time in milliseconds to wait between retries.
880
880
  * This option is ignored if the `recursive` option is not `true`.
881
881
  * @default 100
882
882
  */
883
- retryDelay?: number;
883
+ retryDelay?: number | undefined;
884
884
  }
885
885
 
886
886
  /**
@@ -910,7 +910,7 @@ declare module 'fs' {
910
910
  * When `true`, exceptions will be ignored if `path` does not exist.
911
911
  * @default false
912
912
  */
913
- force?: boolean;
913
+ force?: boolean | undefined;
914
914
  /**
915
915
  * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
916
916
  * `EPERM` error is encountered, Node.js will retry the operation with a linear
@@ -919,19 +919,19 @@ declare module 'fs' {
919
919
  * `true`.
920
920
  * @default 0
921
921
  */
922
- maxRetries?: number;
922
+ maxRetries?: number | undefined;
923
923
  /**
924
924
  * If `true`, perform a recursive directory removal. In
925
925
  * recursive mode, operations are retried on failure.
926
926
  * @default false
927
927
  */
928
- recursive?: boolean;
928
+ recursive?: boolean | undefined;
929
929
  /**
930
930
  * The amount of time in milliseconds to wait between retries.
931
931
  * This option is ignored if the `recursive` option is not `true`.
932
932
  * @default 100
933
933
  */
934
- retryDelay?: number;
934
+ retryDelay?: number | undefined;
935
935
  }
936
936
 
937
937
  /**
@@ -959,12 +959,12 @@ declare module 'fs' {
959
959
  * If a folder was created, the path to the first created folder will be returned.
960
960
  * @default false
961
961
  */
962
- recursive?: boolean;
962
+ recursive?: boolean | undefined;
963
963
  /**
964
964
  * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
965
965
  * @default 0o777
966
966
  */
967
- mode?: Mode;
967
+ mode?: Mode | undefined;
968
968
  }
969
969
 
970
970
  /**
@@ -981,7 +981,7 @@ declare module 'fs' {
981
981
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
982
982
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
983
983
  */
984
- export function mkdir(path: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null | undefined, callback: NoParamCallback): void;
984
+ export function mkdir(path: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null | undefined, callback: NoParamCallback): void;
985
985
 
986
986
  /**
987
987
  * Asynchronous mkdir(2) - create a directory.
@@ -1013,7 +1013,7 @@ declare module 'fs' {
1013
1013
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1014
1014
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1015
1015
  */
1016
- function __promisify__(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise<void>;
1016
+ function __promisify__(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null): Promise<void>;
1017
1017
 
1018
1018
  /**
1019
1019
  * Asynchronous mkdir(2) - create a directory.
@@ -1038,7 +1038,7 @@ declare module 'fs' {
1038
1038
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1039
1039
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1040
1040
  */
1041
- export function mkdirSync(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): void;
1041
+ export function mkdirSync(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null): void;
1042
1042
 
1043
1043
  /**
1044
1044
  * Synchronous mkdir(2) - create a directory.
@@ -1127,7 +1127,7 @@ declare module 'fs' {
1127
1127
  */
1128
1128
  export function readdir(
1129
1129
  path: PathLike,
1130
- options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null,
1130
+ options: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | undefined | null,
1131
1131
  callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
1132
1132
  ): void;
1133
1133
 
@@ -1136,7 +1136,11 @@ declare module 'fs' {
1136
1136
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1137
1137
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1138
1138
  */
1139
- export function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void;
1139
+ export function readdir(
1140
+ path: PathLike,
1141
+ options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer",
1142
+ callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void
1143
+ ): void;
1140
1144
 
1141
1145
  /**
1142
1146
  * Asynchronous readdir(3) - read a directory.
@@ -1145,7 +1149,7 @@ declare module 'fs' {
1145
1149
  */
1146
1150
  export function readdir(
1147
1151
  path: PathLike,
1148
- options: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | undefined | null,
1152
+ options: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | undefined | null,
1149
1153
  callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
1150
1154
  ): void;
1151
1155
 
@@ -1169,21 +1173,21 @@ declare module 'fs' {
1169
1173
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1170
1174
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1171
1175
  */
1172
- function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
1176
+ function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[]>;
1173
1177
 
1174
1178
  /**
1175
1179
  * Asynchronous readdir(3) - read a directory.
1176
1180
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1177
1181
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1178
1182
  */
1179
- function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false }): Promise<Buffer[]>;
1183
+ function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false | undefined }): Promise<Buffer[]>;
1180
1184
 
1181
1185
  /**
1182
1186
  * Asynchronous readdir(3) - read a directory.
1183
1187
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1184
1188
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1185
1189
  */
1186
- function __promisify__(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise<string[] | Buffer[]>;
1190
+ function __promisify__(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[] | Buffer[]>;
1187
1191
 
1188
1192
  /**
1189
1193
  * Asynchronous readdir(3) - read a directory.
@@ -1198,21 +1202,21 @@ declare module 'fs' {
1198
1202
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1199
1203
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1200
1204
  */
1201
- export function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): string[];
1205
+ export function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null): string[];
1202
1206
 
1203
1207
  /**
1204
1208
  * Synchronous readdir(3) - read a directory.
1205
1209
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1206
1210
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1207
1211
  */
1208
- export function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Buffer[];
1212
+ export function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer"): Buffer[];
1209
1213
 
1210
1214
  /**
1211
1215
  * Synchronous readdir(3) - read a directory.
1212
1216
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1213
1217
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1214
1218
  */
1215
- export function readdirSync(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): string[] | Buffer[];
1219
+ export function readdirSync(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): string[] | Buffer[];
1216
1220
 
1217
1221
  /**
1218
1222
  * Synchronous readdir(3) - read a directory.
@@ -1511,15 +1515,15 @@ declare module 'fs' {
1511
1515
  /**
1512
1516
  * @default 0
1513
1517
  */
1514
- offset?: number;
1518
+ offset?: number | undefined;
1515
1519
  /**
1516
1520
  * @default `length of buffer`
1517
1521
  */
1518
- length?: number;
1522
+ length?: number | undefined;
1519
1523
  /**
1520
1524
  * @default null
1521
1525
  */
1522
- position?: ReadPosition | null;
1526
+ position?: ReadPosition | null | undefined;
1523
1527
  }
1524
1528
 
1525
1529
  /**
@@ -1547,7 +1551,7 @@ declare module 'fs' {
1547
1551
  */
1548
1552
  export function readFile(
1549
1553
  path: PathLike | number,
1550
- options: { encoding?: null; flag?: string; } & Abortable | undefined | null,
1554
+ options: { encoding?: null | undefined; flag?: string | undefined; } & Abortable | undefined | null,
1551
1555
  callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
1552
1556
  ): void;
1553
1557
 
@@ -1560,7 +1564,7 @@ declare module 'fs' {
1560
1564
  */
1561
1565
  export function readFile(
1562
1566
  path: PathLike | number,
1563
- options: { encoding: BufferEncoding; flag?: string; } & Abortable | string,
1567
+ options: { encoding: BufferEncoding; flag?: string | undefined; } & Abortable | string,
1564
1568
  callback: (err: NodeJS.ErrnoException | null, data: string) => void,
1565
1569
  ): void;
1566
1570
 
@@ -1574,7 +1578,7 @@ declare module 'fs' {
1574
1578
  export function readFile(
1575
1579
  path: PathLike | number,
1576
1580
  // TODO: unify the options across all readfile functions
1577
- options: BaseEncodingOptions & { flag?: string; } & Abortable | string | undefined | null,
1581
+ options: BaseEncodingOptions & { flag?: string | undefined; } & Abortable | string | undefined | null,
1578
1582
  callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
1579
1583
  ): void;
1580
1584
 
@@ -1594,7 +1598,7 @@ declare module 'fs' {
1594
1598
  * @param options An object that may contain an optional flag.
1595
1599
  * If a flag is not provided, it defaults to `'r'`.
1596
1600
  */
1597
- function __promisify__(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Promise<Buffer>;
1601
+ function __promisify__(path: PathLike | number, options?: { encoding?: null | undefined; flag?: string | undefined; } | null): Promise<Buffer>;
1598
1602
 
1599
1603
  /**
1600
1604
  * Asynchronously reads the entire contents of a file.
@@ -1604,7 +1608,7 @@ declare module 'fs' {
1604
1608
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1605
1609
  * If a flag is not provided, it defaults to `'r'`.
1606
1610
  */
1607
- function __promisify__(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } | string): Promise<string>;
1611
+ function __promisify__(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string | undefined; } | string): Promise<string>;
1608
1612
 
1609
1613
  /**
1610
1614
  * Asynchronously reads the entire contents of a file.
@@ -1614,7 +1618,7 @@ declare module 'fs' {
1614
1618
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1615
1619
  * If a flag is not provided, it defaults to `'r'`.
1616
1620
  */
1617
- function __promisify__(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string; } | string | null): Promise<string | Buffer>;
1621
+ function __promisify__(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string | undefined; } | string | null): Promise<string | Buffer>;
1618
1622
  }
1619
1623
 
1620
1624
  /**
@@ -1623,7 +1627,7 @@ declare module 'fs' {
1623
1627
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1624
1628
  * @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`.
1625
1629
  */
1626
- export function readFileSync(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Buffer;
1630
+ export function readFileSync(path: PathLike | number, options?: { encoding?: null | undefined; flag?: string | undefined; } | null): Buffer;
1627
1631
 
1628
1632
  /**
1629
1633
  * Synchronously reads the entire contents of a file.
@@ -1632,7 +1636,7 @@ declare module 'fs' {
1632
1636
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1633
1637
  * If a flag is not provided, it defaults to `'r'`.
1634
1638
  */
1635
- export function readFileSync(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } | BufferEncoding): string;
1639
+ export function readFileSync(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string | undefined; } | BufferEncoding): string;
1636
1640
 
1637
1641
  /**
1638
1642
  * Synchronously reads the entire contents of a file.
@@ -1641,9 +1645,9 @@ declare module 'fs' {
1641
1645
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1642
1646
  * If a flag is not provided, it defaults to `'r'`.
1643
1647
  */
1644
- export function readFileSync(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string; } | BufferEncoding | null): string | Buffer;
1648
+ export function readFileSync(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string | undefined; } | BufferEncoding | null): string | Buffer;
1645
1649
 
1646
- export type WriteFileOptions = (BaseEncodingOptions & Abortable & { mode?: Mode; flag?: string; }) | string | null;
1650
+ export type WriteFileOptions = (BaseEncodingOptions & Abortable & { mode?: Mode | undefined; flag?: string | undefined; }) | string | null;
1647
1651
 
1648
1652
  /**
1649
1653
  * Asynchronously writes data to a file, replacing the file if it already exists.
@@ -1750,7 +1754,7 @@ declare module 'fs' {
1750
1754
  /**
1751
1755
  * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
1752
1756
  */
1753
- export function watchFile(filename: PathLike, options: { persistent?: boolean; interval?: number; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
1757
+ export function watchFile(filename: PathLike, options: { persistent?: boolean | undefined; interval?: number | undefined; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
1754
1758
 
1755
1759
  /**
1756
1760
  * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
@@ -1765,9 +1769,9 @@ declare module 'fs' {
1765
1769
  export function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
1766
1770
 
1767
1771
  export interface WatchOptions extends Abortable {
1768
- encoding?: BufferEncoding | "buffer";
1769
- persistent?: boolean;
1770
- recursive?: boolean;
1772
+ encoding?: BufferEncoding | "buffer" | undefined;
1773
+ persistent?: boolean | undefined;
1774
+ recursive?: boolean | undefined;
1771
1775
  }
1772
1776
 
1773
1777
  export type WatchListener<T> = (event: "rename" | "change", filename: T) => void;
@@ -2026,21 +2030,21 @@ declare module 'fs' {
2026
2030
  export function accessSync(path: PathLike, mode?: number): void;
2027
2031
 
2028
2032
  interface StreamOptions {
2029
- flags?: string;
2030
- encoding?: BufferEncoding;
2031
- fd?: number | promises.FileHandle;
2032
- mode?: number;
2033
- autoClose?: boolean;
2033
+ flags?: string | undefined;
2034
+ encoding?: BufferEncoding | undefined;
2035
+ fd?: number | promises.FileHandle | undefined;
2036
+ mode?: number | undefined;
2037
+ autoClose?: boolean | undefined;
2034
2038
  /**
2035
2039
  * @default false
2036
2040
  */
2037
- emitClose?: boolean;
2038
- start?: number;
2039
- highWaterMark?: number;
2041
+ emitClose?: boolean | undefined;
2042
+ start?: number | undefined;
2043
+ highWaterMark?: number | undefined;
2040
2044
  }
2041
2045
 
2042
2046
  interface ReadStreamOptions extends StreamOptions {
2043
- end?: number;
2047
+ end?: number | undefined;
2044
2048
  }
2045
2049
 
2046
2050
  /**
@@ -2187,14 +2191,14 @@ declare module 'fs' {
2187
2191
  export function readvSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
2188
2192
 
2189
2193
  export interface OpenDirOptions {
2190
- encoding?: BufferEncoding;
2194
+ encoding?: BufferEncoding | undefined;
2191
2195
  /**
2192
2196
  * Number of directory entries that are buffered
2193
2197
  * internally when reading from the directory. Higher values lead to better
2194
2198
  * performance but higher memory usage.
2195
2199
  * @default 32
2196
2200
  */
2197
- bufferSize?: number;
2201
+ bufferSize?: number | undefined;
2198
2202
  }
2199
2203
 
2200
2204
  export function opendirSync(path: string, options?: OpenDirOptions): Dir;
@@ -2221,8 +2225,8 @@ declare module 'fs' {
2221
2225
  }
2222
2226
 
2223
2227
  export interface StatOptions {
2224
- bigint?: boolean;
2225
- throwIfNoEntry?: boolean;
2228
+ bigint?: boolean | undefined;
2229
+ throwIfNoEntry?: boolean | undefined;
2226
2230
  }
2227
2231
  }
2228
2232