@types/node 15.14.7 → 16.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. {node v15.14 → node}/LICENSE +0 -0
  2. node v15.14/README.md → node/README.md +3 -3
  3. node/assert/strict.d.ts +9 -0
  4. node v15.14/assert.d.ts → node/assert.d.ts +35 -30
  5. node v15.14/async_hooks.d.ts → node/async_hooks.d.ts +7 -3
  6. {node v15.14 → node}/base.d.ts +0 -0
  7. node/buffer.d.ts +357 -0
  8. node v15.14/child_process.d.ts → node/child_process.d.ts +54 -50
  9. node v15.14/cluster.d.ts → node/cluster.d.ts +33 -108
  10. node v15.14/console.d.ts → node/console.d.ts +24 -23
  11. node v15.14/constants.d.ts → node/constants.d.ts +5 -0
  12. node v15.14/crypto.d.ts → node/crypto.d.ts +82 -67
  13. node v15.14/dgram.d.ts → node/dgram.d.ts +13 -9
  14. node v15.14/diagnostic_channel.d.ts → node/diagnostic_channel.d.ts +4 -0
  15. node v15.14/dns/promises.d.ts → node/dns/promises.d.ts +4 -0
  16. node v15.14/dns.d.ts → node/dns.d.ts +15 -11
  17. node/domain.d.ts +25 -0
  18. node v15.14/events.d.ts → node/events.d.ts +8 -3
  19. node v15.14/fs/promises.d.ts → node/fs/promises.d.ts +25 -17
  20. node v15.14/fs.d.ts → node/fs.d.ts +71 -75
  21. node/globals.d.ts +274 -0
  22. node/globals.global.d.ts +1 -0
  23. node v15.14/http.d.ts → node/http.d.ts +109 -167
  24. node v15.14/http2.d.ts → node/http2.d.ts +69 -66
  25. node/https.d.ts +40 -0
  26. node v15.14/index.d.ts → node/index.d.ts +1 -1
  27. node v15.14/inspector.d.ts → node/inspector.d.ts +152 -470
  28. node v15.14/module.d.ts → node/module.d.ts +25 -4
  29. node v15.14/net.d.ts → node/net.d.ts +34 -36
  30. node v15.14/os.d.ts → node/os.d.ts +4 -0
  31. node v15.14/package.json → node/package.json +2 -2
  32. node v15.14/path.d.ts → node/path.d.ts +10 -5
  33. node v15.14/perf_hooks.d.ts → node/perf_hooks.d.ts +70 -23
  34. node v15.14/process.d.ts → node/process.d.ts +54 -51
  35. node v15.14/punycode.d.ts → node/punycode.d.ts +4 -0
  36. node v15.14/querystring.d.ts → node/querystring.d.ts +7 -3
  37. node v15.14/readline.d.ts → node/readline.d.ts +20 -16
  38. node v15.14/repl.d.ts → node/repl.d.ts +18 -14
  39. node v15.14/stream/promises.d.ts → node/stream/promises.d.ts +4 -0
  40. node v15.14/stream.d.ts → node/stream.d.ts +22 -17
  41. node v15.14/string_decoder.d.ts → node/string_decoder.d.ts +4 -0
  42. node v15.14/timers/promises.d.ts → node/timers/promises.d.ts +4 -0
  43. node/timers.d.ts +92 -0
  44. node v15.14/tls.d.ts → node/tls.d.ts +54 -50
  45. node v15.14/trace_events.d.ts → node/trace_events.d.ts +4 -0
  46. node v15.14/ts3.6/assert.d.ts → node/ts3.6/assert.d.ts +26 -26
  47. {node v15.14 → node}/ts3.6/base.d.ts +0 -0
  48. {node v15.14 → node}/ts3.6/index.d.ts +0 -0
  49. node v15.14/tty.d.ts → node/tty.d.ts +4 -0
  50. node v15.14/url.d.ts → node/url.d.ts +19 -15
  51. node/util/types.d.ts +57 -0
  52. node v15.14/util.d.ts → node/util.d.ts +67 -21
  53. node v15.14/v8.d.ts → node/v8.d.ts +4 -0
  54. node v15.14/vm.d.ts → node/vm.d.ts +28 -24
  55. node v15.14/wasi.d.ts → node/wasi.d.ts +11 -7
  56. node v15.14/worker_threads.d.ts → node/worker_threads.d.ts +19 -15
  57. node v15.14/zlib.d.ts → node/zlib.d.ts +20 -16
  58. node v15.14/assert/strict.d.ts +0 -4
  59. node v15.14/buffer.d.ts +0 -112
  60. node v15.14/domain.d.ts +0 -24
  61. node v15.14/globals.d.ts +0 -659
  62. node v15.14/globals.global.d.ts +0 -1
  63. node v15.14/https.d.ts +0 -139
  64. node v15.14/timers.d.ts +0 -27
  65. node v15.14/util/types.d.ts +0 -53
@@ -154,7 +154,7 @@ declare module 'crypto' {
154
154
  * For XOF hash functions such as `shake256`, the
155
155
  * outputLength option can be used to specify the desired output length in bytes.
156
156
  */
157
- outputLength?: number;
157
+ outputLength?: number | undefined;
158
158
  }
159
159
 
160
160
  /** @deprecated since v10.0.0 */
@@ -193,67 +193,71 @@ declare module 'crypto' {
193
193
  interface KeyExportOptions<T extends KeyFormat> {
194
194
  type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1';
195
195
  format: T;
196
- cipher?: string;
197
- passphrase?: string | Buffer;
196
+ cipher?: string | undefined;
197
+ passphrase?: string | Buffer | undefined;
198
198
  }
199
-
200
199
  interface JwkKeyExportOptions {
201
200
  format: 'jwk';
202
201
  }
203
-
204
202
  interface JsonWebKey {
205
- crv?: string;
206
- d?: string;
207
- dp?: string;
208
- dq?: string;
209
- e?: string;
210
- k?: string;
211
- kty?: string;
212
- n?: string;
213
- p?: string;
214
- q?: string;
215
- qi?: string;
216
- x?: string;
217
- y?: string;
203
+ crv?: string | undefined;
204
+ d?: string | undefined;
205
+ dp?: string | undefined;
206
+ dq?: string | undefined;
207
+ e?: string | undefined;
208
+ k?: string | undefined;
209
+ kty?: string | undefined;
210
+ n?: string | undefined;
211
+ p?: string | undefined;
212
+ q?: string | undefined;
213
+ qi?: string | undefined;
214
+ x?: string | undefined;
215
+ y?: string | undefined;
216
+ [key: string]: unknown;
218
217
  }
219
218
 
220
219
  interface AsymmetricKeyDetails {
221
220
  /**
222
221
  * Key size in bits (RSA, DSA).
223
222
  */
224
- modulusLength?: number;
223
+ modulusLength?: number | undefined;
225
224
  /**
226
225
  * Public exponent (RSA).
227
226
  */
228
- publicExponent?: bigint;
227
+ publicExponent?: bigint | undefined;
229
228
  /**
230
229
  * Size of q in bits (DSA).
231
230
  */
232
- divisorLength?: number;
231
+ divisorLength?: number | undefined;
233
232
  /**
234
233
  * Name of the curve (EC).
235
234
  */
236
- namedCurve?: string;
235
+ namedCurve?: string | undefined;
236
+ }
237
+
238
+ interface JwkKeyExportOptions {
239
+ format: 'jwk';
237
240
  }
238
241
 
239
242
  class KeyObject {
240
243
  private constructor();
241
- asymmetricKeyType?: KeyType;
244
+ asymmetricKeyType?: KeyType | undefined;
242
245
  /**
243
246
  * For asymmetric keys, this property represents the size of the embedded key in
244
247
  * bytes. This property is `undefined` for symmetric keys.
245
248
  */
246
- asymmetricKeySize?: number;
249
+ asymmetricKeySize?: number | undefined;
247
250
  /**
248
251
  * This property exists only on asymmetric keys. Depending on the type of the key,
249
252
  * this object contains information about the key. None of the information obtained
250
253
  * through this property can be used to uniquely identify a key or to compromise the
251
254
  * security of the key.
252
255
  */
253
- asymmetricKeyDetails?: AsymmetricKeyDetails;
256
+ asymmetricKeyDetails?: AsymmetricKeyDetails | undefined;
254
257
  export(options: KeyExportOptions<'pem'>): string | Buffer;
255
258
  export(options?: KeyExportOptions<'der'>): Buffer;
256
- symmetricKeySize?: number;
259
+ export(options?: JwkKeyExportOptions): JsonWebKey;
260
+ symmetricKeySize?: number | undefined;
257
261
  type: KeyObjectType;
258
262
  }
259
263
 
@@ -268,7 +272,7 @@ declare module 'crypto' {
268
272
  authTagLength: number;
269
273
  }
270
274
  interface CipherGCMOptions extends stream.TransformOptions {
271
- authTagLength?: number;
275
+ authTagLength?: number | undefined;
272
276
  }
273
277
  /** @deprecated since v10.0.0 use `createCipheriv()` */
274
278
  function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM;
@@ -365,19 +369,26 @@ declare module 'crypto' {
365
369
 
366
370
  interface PrivateKeyInput {
367
371
  key: string | Buffer;
368
- format?: KeyFormat;
369
- type?: 'pkcs1' | 'pkcs8' | 'sec1';
370
- passphrase?: string | Buffer;
372
+ format?: KeyFormat | undefined;
373
+ type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
374
+ passphrase?: string | Buffer | undefined;
371
375
  }
372
376
 
373
377
  interface PublicKeyInput {
374
378
  key: string | Buffer;
375
- format?: KeyFormat;
376
- type?: 'pkcs1' | 'spki';
379
+ format?: KeyFormat | undefined;
380
+ type?: 'pkcs1' | 'spki' | undefined;
377
381
  }
378
382
 
379
- function createPrivateKey(key: PrivateKeyInput | string | Buffer): KeyObject;
380
- function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject): KeyObject;
383
+ function generateKey(type: 'hmac' | 'aes', options: {length: number}, callback: (err: Error | null, key: KeyObject) => void): void;
384
+
385
+ interface JsonWebKeyInput {
386
+ key: JsonWebKey;
387
+ format: 'jwk';
388
+ }
389
+
390
+ function createPrivateKey(key: PrivateKeyInput | string | Buffer | JsonWebKeyInput): KeyObject;
391
+ function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject;
381
392
  function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject;
382
393
 
383
394
  function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
@@ -388,9 +399,9 @@ declare module 'crypto' {
388
399
  /**
389
400
  * @See crypto.constants.RSA_PKCS1_PADDING
390
401
  */
391
- padding?: number;
392
- saltLength?: number;
393
- dsaEncoding?: DSAEncoding;
402
+ padding?: number | undefined;
403
+ saltLength?: number | undefined;
404
+ dsaEncoding?: DSAEncoding | undefined;
394
405
  }
395
406
 
396
407
  interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions { }
@@ -481,7 +492,7 @@ declare module 'crypto' {
481
492
  iterations: number,
482
493
  keylen: number,
483
494
  digest: string,
484
- callback: (err: Error | null, derivedKey: Buffer) => any,
495
+ callback: (err: Error | null, derivedKey: Buffer) => void,
485
496
  ): void;
486
497
  function pbkdf2Sync(
487
498
  password: BinaryLike,
@@ -519,13 +530,13 @@ declare module 'crypto' {
519
530
  ): void;
520
531
 
521
532
  interface ScryptOptions {
522
- cost?: number;
523
- blockSize?: number;
524
- parallelization?: number;
525
- N?: number;
526
- r?: number;
527
- p?: number;
528
- maxmem?: number;
533
+ cost?: number | undefined;
534
+ blockSize?: number | undefined;
535
+ parallelization?: number | undefined;
536
+ N?: number | undefined;
537
+ r?: number | undefined;
538
+ p?: number | undefined;
539
+ maxmem?: number | undefined;
529
540
  }
530
541
  function scrypt(
531
542
  password: BinaryLike,
@@ -544,17 +555,17 @@ declare module 'crypto' {
544
555
 
545
556
  interface RsaPublicKey {
546
557
  key: KeyLike;
547
- padding?: number;
558
+ padding?: number | undefined;
548
559
  }
549
560
  interface RsaPrivateKey {
550
561
  key: KeyLike;
551
- passphrase?: string;
562
+ passphrase?: string | undefined;
552
563
  /**
553
564
  * @default 'sha1'
554
565
  */
555
- oaepHash?: string;
556
- oaepLabel?: NodeJS.TypedArray;
557
- padding?: number;
566
+ oaepHash?: string | undefined;
567
+ oaepLabel?: NodeJS.TypedArray | undefined;
568
+ padding?: number | undefined;
558
569
  }
559
570
  function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
560
571
  function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
@@ -600,8 +611,8 @@ declare module 'crypto' {
600
611
 
601
612
  interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
602
613
  format: T;
603
- cipher?: string;
604
- passphrase?: string;
614
+ cipher?: string | undefined;
615
+ passphrase?: string | undefined;
605
616
  }
606
617
 
607
618
  interface KeyPairKeyObjectResult {
@@ -649,7 +660,7 @@ declare module 'crypto' {
649
660
  /**
650
661
  * @default 0x10001
651
662
  */
652
- publicExponent?: number;
663
+ publicExponent?: number | undefined;
653
664
  }
654
665
 
655
666
  interface DSAKeyPairKeyObjectOptions {
@@ -672,7 +683,7 @@ declare module 'crypto' {
672
683
  /**
673
684
  * @default 0x10001
674
685
  */
675
- publicExponent?: number;
686
+ publicExponent?: number | undefined;
676
687
 
677
688
  publicKeyEncoding: {
678
689
  type: 'pkcs1' | 'spki';
@@ -1259,11 +1270,11 @@ declare module 'crypto' {
1259
1270
  /**
1260
1271
  * A test key length.
1261
1272
  */
1262
- keyLength?: number;
1273
+ keyLength?: number | undefined;
1263
1274
  /**
1264
1275
  * A test IV length.
1265
1276
  */
1266
- ivLength?: number;
1277
+ ivLength?: number | undefined;
1267
1278
  }
1268
1279
 
1269
1280
  interface CipherInfo {
@@ -1279,12 +1290,12 @@ declare module 'crypto' {
1279
1290
  * The block size of the cipher in bytes.
1280
1291
  * This property is omitted when mode is 'stream'.
1281
1292
  */
1282
- blockSize?: number;
1293
+ blockSize?: number | undefined;
1283
1294
  /**
1284
1295
  * The expected or default initialization vector length in bytes.
1285
1296
  * This property is omitted if the cipher does not use an initialization vector.
1286
1297
  */
1287
- ivLength?: number;
1298
+ ivLength?: number | undefined;
1288
1299
  /**
1289
1300
  * The expected or default key length in bytes.
1290
1301
  */
@@ -1316,7 +1327,7 @@ declare module 'crypto' {
1316
1327
  * The successfully generated `derivedKey` will be passed to the callback as an `ArrayBuffer`.
1317
1328
  * An error will be thrown if any of the input aguments specify invalid values or types.
1318
1329
  */
1319
- function hkdf(digest: string, key: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: ArrayBuffer) => any): void;
1330
+ function hkdf(digest: string, key: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: ArrayBuffer) => void): void;
1320
1331
 
1321
1332
  /**
1322
1333
  * Provides a synchronous HKDF key derivation function as defined in RFC 5869.
@@ -1363,7 +1374,7 @@ declare module 'crypto' {
1363
1374
  *
1364
1375
  * @default `false`
1365
1376
  */
1366
- disableEntropyCache?: boolean;
1377
+ disableEntropyCache?: boolean | undefined;
1367
1378
  }
1368
1379
 
1369
1380
  function randomUUID(options?: RandomUUIDOptions): string;
@@ -1439,7 +1450,7 @@ declare module 'crypto' {
1439
1450
  /**
1440
1451
  * The issuer certificate or `undefined` if the issuer certificate is not available.
1441
1452
  */
1442
- readonly issuerCertificate?: X509Certificate;
1453
+ readonly issuerCertificate?: X509Certificate | undefined;
1443
1454
 
1444
1455
  /**
1445
1456
  * The public key for this certificate.
@@ -1526,13 +1537,13 @@ declare module 'crypto' {
1526
1537
  type LargeNumberLike = NodeJS.ArrayBufferView | SharedArrayBuffer | ArrayBuffer | bigint;
1527
1538
 
1528
1539
  interface GeneratePrimeOptions {
1529
- add?: LargeNumberLike;
1530
- rem?: LargeNumberLike;
1540
+ add?: LargeNumberLike | undefined;
1541
+ rem?: LargeNumberLike | undefined;
1531
1542
  /**
1532
1543
  * @default false
1533
1544
  */
1534
- safe?: boolean;
1535
- bigint?: boolean;
1545
+ safe?: boolean | undefined;
1546
+ bigint?: boolean | undefined;
1536
1547
  }
1537
1548
 
1538
1549
  interface GeneratePrimeOptionsBigInt extends GeneratePrimeOptions {
@@ -1540,7 +1551,7 @@ declare module 'crypto' {
1540
1551
  }
1541
1552
 
1542
1553
  interface GeneratePrimeOptionsArrayBuffer extends GeneratePrimeOptions {
1543
- bigint?: false;
1554
+ bigint?: false | undefined;
1544
1555
  }
1545
1556
 
1546
1557
  function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
@@ -1562,7 +1573,7 @@ declare module 'crypto' {
1562
1573
  *
1563
1574
  * @default 0
1564
1575
  */
1565
- checks?: number;
1576
+ checks?: number | undefined;
1566
1577
  }
1567
1578
 
1568
1579
  /**
@@ -1576,3 +1587,7 @@ declare module 'crypto' {
1576
1587
  */
1577
1588
  function checkPrimeSync(value: LargeNumberLike, options?: CheckPrimeOptions): boolean;
1578
1589
  }
1590
+
1591
+ declare module 'node:crypto' {
1592
+ export * from 'crypto';
1593
+ }
@@ -11,24 +11,24 @@ declare module 'dgram' {
11
11
  }
12
12
 
13
13
  interface BindOptions {
14
- port?: number;
15
- address?: string;
16
- exclusive?: boolean;
17
- fd?: number;
14
+ port?: number | undefined;
15
+ address?: string | undefined;
16
+ exclusive?: boolean | undefined;
17
+ fd?: number | undefined;
18
18
  }
19
19
 
20
20
  type SocketType = "udp4" | "udp6";
21
21
 
22
22
  interface SocketOptions extends Abortable {
23
23
  type: SocketType;
24
- reuseAddr?: boolean;
24
+ reuseAddr?: boolean | undefined;
25
25
  /**
26
26
  * @default false
27
27
  */
28
- ipv6Only?: boolean;
29
- recvBufferSize?: number;
30
- sendBufferSize?: number;
31
- lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
28
+ ipv6Only?: boolean | undefined;
29
+ recvBufferSize?: number | undefined;
30
+ sendBufferSize?: number | undefined;
31
+ lookup?: ((hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void) | undefined;
32
32
  }
33
33
 
34
34
  function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
@@ -139,3 +139,7 @@ declare module 'dgram' {
139
139
  prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
140
140
  }
141
141
  }
142
+
143
+ declare module 'node:dgram' {
144
+ export * from 'dgram';
145
+ }
@@ -32,3 +32,7 @@ declare module 'diagnostic_channel' {
32
32
  unsubscribe(listener: ChannelListener): void;
33
33
  }
34
34
  }
35
+
36
+ declare module 'node:diagnostic_channel' {
37
+ export * from 'diagnostic_channel';
38
+ }
@@ -95,3 +95,7 @@ declare module "dns/promises" {
95
95
  setServers: typeof setServers;
96
96
  }
97
97
  }
98
+
99
+ declare module 'node:dns/promises' {
100
+ export * from 'dns/promises';
101
+ }
@@ -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 {
@@ -320,3 +320,7 @@ declare module 'dns' {
320
320
 
321
321
  export { dnsPromises as promises };
322
322
  }
323
+
324
+ declare module 'node:dns' {
325
+ export * from 'dns';
326
+ }
node/domain.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @deprecated
3
+ */
4
+ declare module 'domain' {
5
+ import EventEmitter = require('events');
6
+ class Domain extends EventEmitter {
7
+ members: Array<EventEmitter | NodeJS.Timer>;
8
+ enter(): void;
9
+ exit(): void;
10
+ run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
11
+ add(emitter: EventEmitter | NodeJS.Timer): void;
12
+ remove(emitter: EventEmitter | NodeJS.Timer): void;
13
+ bind<T extends Function>(cb: T): T;
14
+ intercept<T extends Function>(cb: T): T;
15
+ }
16
+
17
+ function create(): Domain;
18
+ }
19
+
20
+ /**
21
+ * @deprecated
22
+ */
23
+ declare module 'node:domain' {
24
+ export * from 'domain';
25
+ }
@@ -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
 
@@ -91,3 +91,8 @@ declare module 'events' {
91
91
 
92
92
  export = EventEmitter;
93
93
  }
94
+
95
+ declare module 'node:events' {
96
+ import events = require('events');
97
+ export = events;
98
+ }
@@ -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
 
@@ -595,3 +599,7 @@ declare module 'fs/promises' {
595
599
  */
596
600
  function watch(filename: PathLike, options: WatchOptions | string): AsyncIterable<string> | AsyncIterable<Buffer>;
597
601
  }
602
+
603
+ declare module 'node:fs/promises' {
604
+ export * from 'fs/promises';
605
+ }