@types/node 14.18.7 → 15.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 (59) hide show
  1. {node v14.18 → node}/LICENSE +0 -0
  2. node/README.md +16 -0
  3. node/assert/strict.d.ts +4 -0
  4. node v14.18/assert.d.ts → node/assert.d.ts +8 -7
  5. node v14.18/async_hooks.d.ts → node/async_hooks.d.ts +11 -7
  6. node/base.d.ts +19 -0
  7. node/buffer.d.ts +26 -0
  8. node v14.18/child_process.d.ts → node/child_process.d.ts +71 -71
  9. node v14.18/cluster.d.ts → node/cluster.d.ts +17 -16
  10. node v14.18/console.d.ts → node/console.d.ts +17 -22
  11. node v14.18/constants.d.ts → node/constants.d.ts +9 -8
  12. node v14.18/crypto.d.ts → node/crypto.d.ts +139 -54
  13. node v14.18/dgram.d.ts → node/dgram.d.ts +24 -23
  14. node/dns/promises.d.ts +101 -0
  15. node/dns.d.ts +326 -0
  16. node v14.18/domain.d.ts → node/domain.d.ts +5 -4
  17. node v14.18/events.d.ts → node/events.d.ts +13 -8
  18. node v14.18/fs/promises.d.ts → node/fs/promises.d.ts +23 -30
  19. node v14.18/fs.d.ts → node/fs.d.ts +85 -97
  20. node v14.18/globals.d.ts → node/globals.d.ts +60 -24
  21. {node v14.18 → node}/globals.global.d.ts +0 -0
  22. node v14.18/http.d.ts → node/http.d.ts +114 -178
  23. node v14.18/http2.d.ts → node/http2.d.ts +86 -79
  24. node/https.d.ts +40 -0
  25. node v14.18/index.d.ts → node/index.d.ts +14 -55
  26. node v14.18/inspector.d.ts → node/inspector.d.ts +159 -162
  27. node v14.18/module.d.ts → node/module.d.ts +6 -5
  28. node v14.18/net.d.ts → node/net.d.ts +77 -45
  29. node v14.18/os.d.ts → node/os.d.ts +4 -3
  30. node v14.18/package.json → node/package.json +20 -19
  31. node v14.18/path.d.ts → node/path.d.ts +10 -9
  32. node v14.18/perf_hooks.d.ts → node/perf_hooks.d.ts +10 -9
  33. node v14.18/process.d.ts → node/process.d.ts +58 -18
  34. node v14.18/punycode.d.ts → node/punycode.d.ts +11 -3
  35. node v14.18/querystring.d.ts → node/querystring.d.ts +7 -6
  36. node v14.18/readline.d.ts → node/readline.d.ts +19 -19
  37. node v14.18/repl.d.ts → node/repl.d.ts +24 -23
  38. node/stream/promises.d.ts +71 -0
  39. node v14.18/stream.d.ts → node/stream.d.ts +170 -61
  40. node v14.18/string_decoder.d.ts → node/string_decoder.d.ts +4 -3
  41. node/timers/promises.d.ts +17 -0
  42. node v14.18/timers.d.ts → node/timers.d.ts +20 -5
  43. node v14.18/tls.d.ts → node/tls.d.ts +56 -57
  44. node v14.18/trace_events.d.ts → node/trace_events.d.ts +4 -3
  45. node/ts3.6/assert.d.ts +103 -0
  46. node/ts3.6/base.d.ts +66 -0
  47. node/ts3.6/index.d.ts +7 -0
  48. node v14.18/tty.d.ts → node/tty.d.ts +5 -4
  49. node v14.18/url.d.ts → node/url.d.ts +21 -20
  50. node v14.18/util.d.ts → node/util.d.ts +7 -12
  51. node v14.18/v8.d.ts → node/v8.d.ts +5 -4
  52. node v14.18/vm.d.ts → node/vm.d.ts +29 -28
  53. node v14.18/wasi.d.ts → node/wasi.d.ts +11 -10
  54. node v14.18/worker_threads.d.ts → node/worker_threads.d.ts +27 -23
  55. node v14.18/zlib.d.ts → node/zlib.d.ts +21 -20
  56. node v14.18/README.md +0 -16
  57. node v14.18/buffer.d.ts +0 -89
  58. node v14.18/dns.d.ts +0 -387
  59. node v14.18/https.d.ts +0 -142
node/dns.d.ts ADDED
@@ -0,0 +1,326 @@
1
+ declare module 'node:dns' {
2
+ export * from 'dns';
3
+ }
4
+
5
+ declare module 'dns' {
6
+ import * as dnsPromises from "node:dns/promises";
7
+
8
+ // Supported getaddrinfo flags.
9
+ export const ADDRCONFIG: number;
10
+ export const V4MAPPED: number;
11
+ /**
12
+ * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
13
+ * well as IPv4 mapped IPv6 addresses.
14
+ */
15
+ export const ALL: number;
16
+
17
+ export interface LookupOptions {
18
+ family?: number;
19
+ hints?: number;
20
+ all?: boolean;
21
+ verbatim?: boolean;
22
+ }
23
+
24
+ export interface LookupOneOptions extends LookupOptions {
25
+ all?: false;
26
+ }
27
+
28
+ export interface LookupAllOptions extends LookupOptions {
29
+ all: true;
30
+ }
31
+
32
+ export interface LookupAddress {
33
+ address: string;
34
+ family: number;
35
+ }
36
+
37
+ export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
38
+ export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
39
+ export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
40
+ export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
41
+ export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
42
+
43
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
44
+ export namespace lookup {
45
+ function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
46
+ function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
47
+ function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
48
+ }
49
+
50
+ export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
51
+
52
+ export namespace lookupService {
53
+ function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
54
+ }
55
+
56
+ export interface ResolveOptions {
57
+ ttl: boolean;
58
+ }
59
+
60
+ export interface ResolveWithTtlOptions extends ResolveOptions {
61
+ ttl: true;
62
+ }
63
+
64
+ export interface RecordWithTtl {
65
+ address: string;
66
+ ttl: number;
67
+ }
68
+
69
+ /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
70
+ export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
71
+
72
+ export interface AnyARecord extends RecordWithTtl {
73
+ type: "A";
74
+ }
75
+
76
+ export interface AnyAaaaRecord extends RecordWithTtl {
77
+ type: "AAAA";
78
+ }
79
+
80
+ export interface CaaRecord {
81
+ critial: number;
82
+ issue?: string;
83
+ issuewild?: string;
84
+ iodef?: string;
85
+ contactemail?: string;
86
+ contactphone?: string;
87
+ }
88
+
89
+ export interface MxRecord {
90
+ priority: number;
91
+ exchange: string;
92
+ }
93
+
94
+ export interface AnyMxRecord extends MxRecord {
95
+ type: "MX";
96
+ }
97
+
98
+ export interface NaptrRecord {
99
+ flags: string;
100
+ service: string;
101
+ regexp: string;
102
+ replacement: string;
103
+ order: number;
104
+ preference: number;
105
+ }
106
+
107
+ export interface AnyNaptrRecord extends NaptrRecord {
108
+ type: "NAPTR";
109
+ }
110
+
111
+ export interface SoaRecord {
112
+ nsname: string;
113
+ hostmaster: string;
114
+ serial: number;
115
+ refresh: number;
116
+ retry: number;
117
+ expire: number;
118
+ minttl: number;
119
+ }
120
+
121
+ export interface AnySoaRecord extends SoaRecord {
122
+ type: "SOA";
123
+ }
124
+
125
+ export interface SrvRecord {
126
+ priority: number;
127
+ weight: number;
128
+ port: number;
129
+ name: string;
130
+ }
131
+
132
+ export interface AnySrvRecord extends SrvRecord {
133
+ type: "SRV";
134
+ }
135
+
136
+ export interface AnyTxtRecord {
137
+ type: "TXT";
138
+ entries: string[];
139
+ }
140
+
141
+ export interface AnyNsRecord {
142
+ type: "NS";
143
+ value: string;
144
+ }
145
+
146
+ export interface AnyPtrRecord {
147
+ type: "PTR";
148
+ value: string;
149
+ }
150
+
151
+ export interface AnyCnameRecord {
152
+ type: "CNAME";
153
+ value: string;
154
+ }
155
+
156
+ export type AnyRecord = AnyARecord |
157
+ AnyAaaaRecord |
158
+ AnyCnameRecord |
159
+ AnyMxRecord |
160
+ AnyNaptrRecord |
161
+ AnyNsRecord |
162
+ AnyPtrRecord |
163
+ AnySoaRecord |
164
+ AnySrvRecord |
165
+ AnyTxtRecord;
166
+
167
+ export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
168
+ export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
169
+ export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
170
+ export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
171
+ export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
172
+ export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
173
+ export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
174
+ export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
175
+ export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
176
+ export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
177
+ export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
178
+ export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
179
+ export function resolve(
180
+ hostname: string,
181
+ rrtype: string,
182
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void,
183
+ ): void;
184
+
185
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
186
+ export namespace resolve {
187
+ function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
188
+ function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
189
+ function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
190
+ function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
191
+ function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
192
+ function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
193
+ function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
194
+ function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
195
+ }
196
+
197
+ export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
198
+ export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
199
+ export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
200
+
201
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
202
+ export namespace resolve4 {
203
+ function __promisify__(hostname: string): Promise<string[]>;
204
+ function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
205
+ function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
206
+ }
207
+
208
+ export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
209
+ export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
210
+ export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
211
+
212
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
213
+ export namespace resolve6 {
214
+ function __promisify__(hostname: string): Promise<string[]>;
215
+ function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
216
+ function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
217
+ }
218
+
219
+ export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
220
+ export namespace resolveCname {
221
+ function __promisify__(hostname: string): Promise<string[]>;
222
+ }
223
+
224
+ export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void;
225
+ export namespace resolveCaa {
226
+ function __promisify__(hostname: string): Promise<CaaRecord[]>;
227
+ }
228
+
229
+ export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
230
+ export namespace resolveMx {
231
+ function __promisify__(hostname: string): Promise<MxRecord[]>;
232
+ }
233
+
234
+ export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
235
+ export namespace resolveNaptr {
236
+ function __promisify__(hostname: string): Promise<NaptrRecord[]>;
237
+ }
238
+
239
+ export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
240
+ export namespace resolveNs {
241
+ function __promisify__(hostname: string): Promise<string[]>;
242
+ }
243
+
244
+ export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
245
+ export namespace resolvePtr {
246
+ function __promisify__(hostname: string): Promise<string[]>;
247
+ }
248
+
249
+ export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
250
+ export namespace resolveSoa {
251
+ function __promisify__(hostname: string): Promise<SoaRecord>;
252
+ }
253
+
254
+ export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
255
+ export namespace resolveSrv {
256
+ function __promisify__(hostname: string): Promise<SrvRecord[]>;
257
+ }
258
+
259
+ export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
260
+ export namespace resolveTxt {
261
+ function __promisify__(hostname: string): Promise<string[][]>;
262
+ }
263
+
264
+ export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
265
+ export namespace resolveAny {
266
+ function __promisify__(hostname: string): Promise<AnyRecord[]>;
267
+ }
268
+
269
+ export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
270
+ export function setServers(servers: ReadonlyArray<string>): void;
271
+ export function getServers(): string[];
272
+
273
+ // Error codes
274
+ export const NODATA: string;
275
+ export const FORMERR: string;
276
+ export const SERVFAIL: string;
277
+ export const NOTFOUND: string;
278
+ export const NOTIMP: string;
279
+ export const REFUSED: string;
280
+ export const BADQUERY: string;
281
+ export const BADNAME: string;
282
+ export const BADFAMILY: string;
283
+ export const BADRESP: string;
284
+ export const CONNREFUSED: string;
285
+ export const TIMEOUT: string;
286
+ export const EOF: string;
287
+ export const FILE: string;
288
+ export const NOMEM: string;
289
+ export const DESTRUCTION: string;
290
+ export const BADSTR: string;
291
+ export const BADFLAGS: string;
292
+ export const NONAME: string;
293
+ export const BADHINTS: string;
294
+ export const NOTINITIALIZED: string;
295
+ export const LOADIPHLPAPI: string;
296
+ export const ADDRGETNETWORKPARAMS: string;
297
+ export const CANCELLED: string;
298
+
299
+ export interface ResolverOptions {
300
+ timeout?: number;
301
+ }
302
+
303
+ export class Resolver {
304
+ constructor(options?: ResolverOptions);
305
+
306
+ cancel(): void;
307
+ getServers: typeof getServers;
308
+ resolve: typeof resolve;
309
+ resolve4: typeof resolve4;
310
+ resolve6: typeof resolve6;
311
+ resolveAny: typeof resolveAny;
312
+ resolveCname: typeof resolveCname;
313
+ resolveMx: typeof resolveMx;
314
+ resolveNaptr: typeof resolveNaptr;
315
+ resolveNs: typeof resolveNs;
316
+ resolvePtr: typeof resolvePtr;
317
+ resolveSoa: typeof resolveSoa;
318
+ resolveSrv: typeof resolveSrv;
319
+ resolveTxt: typeof resolveTxt;
320
+ reverse: typeof reverse;
321
+ setLocalAddress(ipv4?: string, ipv6?: string): void;
322
+ setServers: typeof setServers;
323
+ }
324
+
325
+ export { dnsPromises as promises };
326
+ }
@@ -1,5 +1,9 @@
1
+ declare module 'node:domain' {
2
+ export * from 'domain';
3
+ }
4
+
1
5
  declare module 'domain' {
2
- import EventEmitter = require('events');
6
+ import EventEmitter = require('node:events');
3
7
 
4
8
  global {
5
9
  namespace NodeJS {
@@ -22,6 +26,3 @@ declare module 'domain' {
22
26
 
23
27
  function create(): Domain;
24
28
  }
25
- declare module 'node:domain' {
26
- export * from 'domain';
27
- }
@@ -1,9 +1,14 @@
1
+ declare module 'node:events' {
2
+ import EventEmitter = require('events');
3
+ export = EventEmitter;
4
+ }
5
+
1
6
  declare module 'events' {
2
7
  interface EventEmitterOptions {
3
8
  /**
4
9
  * Enables automatic capturing of promise rejection.
5
10
  */
6
- captureRejections?: boolean | undefined;
11
+ captureRejections?: boolean;
7
12
  }
8
13
 
9
14
  interface NodeEventTarget {
@@ -14,13 +19,17 @@ declare module 'events' {
14
19
  addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any;
15
20
  }
16
21
 
22
+ interface StaticEventEmitterOptions {
23
+ signal?: AbortSignal;
24
+ }
25
+
17
26
  interface EventEmitter extends NodeJS.EventEmitter {}
18
27
  class EventEmitter {
19
28
  constructor(options?: EventEmitterOptions);
20
29
 
21
- static once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>;
22
- static once(emitter: DOMEventTarget, event: string): Promise<any[]>;
23
- static on(emitter: NodeJS.EventEmitter, event: string): AsyncIterableIterator<any>;
30
+ static once(emitter: NodeEventTarget, event: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
31
+ static once(emitter: DOMEventTarget, event: string, options?: StaticEventEmitterOptions): Promise<any[]>;
32
+ static on(emitter: NodeJS.EventEmitter, event: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
24
33
 
25
34
  /** @deprecated since v4.0.0 */
26
35
  static listenerCount(emitter: NodeJS.EventEmitter, event: string | symbol): number;
@@ -76,7 +85,3 @@ declare module 'events' {
76
85
 
77
86
  export = EventEmitter;
78
87
  }
79
- declare module 'node:events' {
80
- import events = require('events');
81
- export = events;
82
- }
@@ -1,4 +1,8 @@
1
1
  declare module 'fs/promises' {
2
+ export * from 'node:fs/promises';
3
+ }
4
+
5
+ declare module 'node:fs/promises' {
2
6
  import {
3
7
  Stats,
4
8
  BigIntStats,
@@ -16,7 +20,7 @@ declare module 'fs/promises' {
16
20
  BufferEncodingOption,
17
21
  OpenMode,
18
22
  Mode,
19
- } from 'fs';
23
+ } from 'node:fs';
20
24
 
21
25
  interface FileHandle {
22
26
  /**
@@ -34,7 +38,7 @@ declare module 'fs/promises' {
34
38
  * If `mode` is a string, it is parsed as an octal integer.
35
39
  * If `flag` is not supplied, the default of `'a'` is used.
36
40
  */
37
- appendFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null): Promise<void>;
41
+ appendFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
38
42
 
39
43
  /**
40
44
  * Asynchronous fchown(2) - Change ownership of a file.
@@ -73,7 +77,7 @@ declare module 'fs/promises' {
73
77
  * @param options An object that may contain an optional flag.
74
78
  * If a flag is not provided, it defaults to `'r'`.
75
79
  */
76
- readFile(options?: { encoding?: null | undefined, flag?: OpenMode | undefined } | null): Promise<Buffer>;
80
+ readFile(options?: { encoding?: null, flag?: OpenMode } | null): Promise<Buffer>;
77
81
 
78
82
  /**
79
83
  * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
@@ -81,7 +85,7 @@ declare module 'fs/promises' {
81
85
  * @param options An object that may contain an optional flag.
82
86
  * If a flag is not provided, it defaults to `'r'`.
83
87
  */
84
- readFile(options: { encoding: BufferEncoding, flag?: OpenMode | undefined } | BufferEncoding): Promise<string>;
88
+ readFile(options: { encoding: BufferEncoding, flag?: OpenMode } | BufferEncoding): Promise<string>;
85
89
 
86
90
  /**
87
91
  * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
@@ -89,12 +93,12 @@ declare module 'fs/promises' {
89
93
  * @param options An object that may contain an optional flag.
90
94
  * If a flag is not provided, it defaults to `'r'`.
91
95
  */
92
- readFile(options?: BaseEncodingOptions & { flag?: OpenMode | undefined } | BufferEncoding | null): Promise<string | Buffer>;
96
+ readFile(options?: BaseEncodingOptions & { flag?: OpenMode } | BufferEncoding | null): Promise<string | Buffer>;
93
97
 
94
98
  /**
95
99
  * Asynchronous fstat(2) - Get file status.
96
100
  */
97
- stat(opts?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
101
+ stat(opts?: StatOptions & { bigint?: false }): Promise<Stats>;
98
102
  stat(opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
99
103
  stat(opts?: StatOptions): Promise<Stats | BigIntStats>;
100
104
 
@@ -143,7 +147,7 @@ declare module 'fs/promises' {
143
147
  * If `mode` is a string, it is parsed as an octal integer.
144
148
  * If `flag` is not supplied, the default of `'w'` is used.
145
149
  */
146
- writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null): Promise<void>;
150
+ writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
147
151
 
148
152
  /**
149
153
  * See `fs.writev` promisified version.
@@ -293,7 +297,7 @@ declare module 'fs/promises' {
293
297
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
294
298
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
295
299
  */
296
- function mkdir(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null): Promise<void>;
300
+ function mkdir(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise<void>;
297
301
 
298
302
  /**
299
303
  * Asynchronous mkdir(2) - create a directory.
@@ -308,21 +312,21 @@ declare module 'fs/promises' {
308
312
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
309
313
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
310
314
  */
311
- function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[]>;
315
+ function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
312
316
 
313
317
  /**
314
318
  * Asynchronous readdir(3) - read a directory.
315
319
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
316
320
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
317
321
  */
318
- function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer"): Promise<Buffer[]>;
322
+ function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Promise<Buffer[]>;
319
323
 
320
324
  /**
321
325
  * Asynchronous readdir(3) - read a directory.
322
326
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
323
327
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
324
328
  */
325
- function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[] | Buffer[]>;
329
+ function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise<string[] | Buffer[]>;
326
330
 
327
331
  /**
328
332
  * Asynchronous readdir(3) - read a directory.
@@ -365,7 +369,7 @@ declare module 'fs/promises' {
365
369
  * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
366
370
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
367
371
  */
368
- function lstat(path: PathLike, opts?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
372
+ function lstat(path: PathLike, opts?: StatOptions & { bigint?: false }): Promise<Stats>;
369
373
  function lstat(path: PathLike, opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
370
374
  function lstat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
371
375
 
@@ -373,7 +377,7 @@ declare module 'fs/promises' {
373
377
  * Asynchronous stat(2) - Get file status.
374
378
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
375
379
  */
376
- function stat(path: PathLike, opts?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
380
+ function stat(path: PathLike, opts?: StatOptions & { bigint?: false }): Promise<Stats>;
377
381
  function stat(path: PathLike, opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
378
382
  function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
379
383
 
@@ -510,11 +514,7 @@ declare module 'fs/promises' {
510
514
  * If `mode` is a string, it is parsed as an octal integer.
511
515
  * If `flag` is not supplied, the default of `'w'` is used.
512
516
  */
513
- function writeFile(
514
- path: PathLike | FileHandle,
515
- data: string | Uint8Array,
516
- options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null
517
- ): Promise<void>;
517
+ function writeFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
518
518
 
519
519
  /**
520
520
  * Asynchronously append data to a file, creating the file if it does not exist.
@@ -528,11 +528,7 @@ declare module 'fs/promises' {
528
528
  * If `mode` is a string, it is parsed as an octal integer.
529
529
  * If `flag` is not supplied, the default of `'a'` is used.
530
530
  */
531
- function appendFile(
532
- path: PathLike | FileHandle,
533
- data: string | Uint8Array,
534
- options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null
535
- ): Promise<void>;
531
+ function appendFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
536
532
 
537
533
  /**
538
534
  * Asynchronously reads the entire contents of a file.
@@ -541,7 +537,7 @@ declare module 'fs/promises' {
541
537
  * @param options An object that may contain an optional flag.
542
538
  * If a flag is not provided, it defaults to `'r'`.
543
539
  */
544
- function readFile(path: PathLike | FileHandle, options?: { encoding?: null | undefined, flag?: OpenMode | undefined } | null): Promise<Buffer>;
540
+ function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: OpenMode } | null): Promise<Buffer>;
545
541
 
546
542
  /**
547
543
  * Asynchronously reads the entire contents of a file.
@@ -550,7 +546,7 @@ declare module 'fs/promises' {
550
546
  * @param options An object that may contain an optional flag.
551
547
  * If a flag is not provided, it defaults to `'r'`.
552
548
  */
553
- function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode | undefined } | BufferEncoding): Promise<string>;
549
+ function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode } | BufferEncoding): Promise<string>;
554
550
 
555
551
  /**
556
552
  * Asynchronously reads the entire contents of a file.
@@ -559,10 +555,7 @@ declare module 'fs/promises' {
559
555
  * @param options An object that may contain an optional flag.
560
556
  * If a flag is not provided, it defaults to `'r'`.
561
557
  */
562
- function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & { flag?: OpenMode | undefined } | BufferEncoding | null): Promise<string | Buffer>;
558
+ function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & { flag?: OpenMode } | BufferEncoding | null): Promise<string | Buffer>;
563
559
 
564
- function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
565
- }
566
- declare module 'node:fs/promises' {
567
- export * from 'fs/promises';
560
+ function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
568
561
  }