@idlebox/stripe-node-types 24.0.14-patch.0 → 24.0.15

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 (134) hide show
  1. package/README.md +1 -1
  2. package/assert/strict.d.ts +113 -1
  3. package/assert.d.ts +162 -248
  4. package/async_hooks.d.ts +20 -5
  5. package/buffer.buffer.d.ts +24 -6
  6. package/buffer.d.ts +63 -168
  7. package/child_process.d.ts +117 -223
  8. package/cluster.d.ts +251 -329
  9. package/compatibility/iterators.d.ts +15 -0
  10. package/console.d.ts +60 -346
  11. package/constants.d.ts +15 -1
  12. package/crypto.d.ts +713 -1149
  13. package/dgram.d.ts +30 -50
  14. package/diagnostics_channel.d.ts +16 -3
  15. package/dns/promises.d.ts +15 -0
  16. package/dns.d.ts +150 -131
  17. package/domain.d.ts +25 -14
  18. package/events.d.ts +858 -719
  19. package/fs/promises.d.ts +117 -53
  20. package/fs.d.ts +729 -484
  21. package/globals.d.ts +142 -344
  22. package/globals.typedarray.d.ts +94 -0
  23. package/http.d.ts +358 -246
  24. package/http2.d.ts +578 -711
  25. package/https.d.ts +85 -216
  26. package/index.d.ts +39 -3
  27. package/inspector/promises.d.ts +54 -0
  28. package/inspector.d.ts +180 -3936
  29. package/inspector.generated.d.ts +4242 -0
  30. package/module.d.ts +60 -95
  31. package/my-shim.d.ts +15 -0
  32. package/net.d.ts +102 -186
  33. package/os.d.ts +32 -6
  34. package/package.json +3 -8
  35. package/path/posix.d.ts +20 -0
  36. package/path/win32.d.ts +20 -0
  37. package/path.d.ts +132 -122
  38. package/perf_hooks.d.ts +310 -644
  39. package/process.d.ts +192 -138
  40. package/punycode.d.ts +17 -2
  41. package/querystring.d.ts +16 -1
  42. package/quic.d.ts +926 -0
  43. package/readline/promises.d.ts +16 -1
  44. package/readline.d.ts +80 -118
  45. package/repl.d.ts +98 -96
  46. package/sea.d.ts +25 -1
  47. package/sqlite.d.ts +277 -13
  48. package/stream/consumers.d.ts +22 -7
  49. package/stream/promises.d.ts +148 -12
  50. package/stream/web.d.ts +187 -494
  51. package/stream.d.ts +608 -490
  52. package/string_decoder.d.ts +18 -3
  53. package/test/reporters.d.ts +112 -0
  54. package/test.d.ts +238 -199
  55. package/timers/promises.d.ts +16 -1
  56. package/timers.d.ts +16 -129
  57. package/tls.d.ts +163 -163
  58. package/trace_events.d.ts +21 -6
  59. package/ts5.6/buffer.buffer.d.ts +25 -8
  60. package/ts5.6/compatibility/float16array.d.ts +15 -0
  61. package/ts5.6/globals.typedarray.d.ts +31 -0
  62. package/ts5.6/index.d.ts +39 -3
  63. package/ts5.7/compatibility/float16array.d.ts +15 -0
  64. package/ts5.7/index.d.ts +39 -3
  65. package/tty.d.ts +70 -13
  66. package/undici-types/agent.d.ts +20 -4
  67. package/undici-types/api.d.ts +15 -0
  68. package/undici-types/balanced-pool.d.ts +15 -0
  69. package/undici-types/cache-interceptor.d.ts +15 -0
  70. package/undici-types/cache.d.ts +15 -0
  71. package/undici-types/client-stats.d.ts +31 -0
  72. package/undici-types/client.d.ts +21 -5
  73. package/undici-types/connector.d.ts +15 -0
  74. package/undici-types/content-type.d.ts +15 -0
  75. package/undici-types/cookies.d.ts +15 -0
  76. package/undici-types/diagnostics-channel.d.ts +24 -1
  77. package/undici-types/dispatcher.d.ts +18 -8
  78. package/undici-types/env-http-proxy-agent.d.ts +17 -1
  79. package/undici-types/errors.d.ts +20 -15
  80. package/undici-types/eventsource.d.ts +24 -4
  81. package/undici-types/fetch.d.ts +16 -0
  82. package/undici-types/formdata.d.ts +15 -0
  83. package/undici-types/global-dispatcher.d.ts +15 -0
  84. package/undici-types/global-origin.d.ts +15 -0
  85. package/undici-types/h2c-client.d.ts +15 -2
  86. package/undici-types/handlers.d.ts +16 -1
  87. package/undici-types/header.d.ts +15 -0
  88. package/undici-types/index.d.ts +21 -1
  89. package/undici-types/interceptors.d.ts +20 -0
  90. package/undici-types/mock-agent.d.ts +18 -0
  91. package/undici-types/mock-call-history.d.ts +15 -0
  92. package/undici-types/mock-client.d.ts +17 -0
  93. package/undici-types/mock-errors.d.ts +15 -0
  94. package/undici-types/mock-interceptor.d.ts +17 -1
  95. package/undici-types/mock-pool.d.ts +17 -0
  96. package/undici-types/package.json +1 -1
  97. package/undici-types/patch.d.ts +15 -0
  98. package/undici-types/pool-stats.d.ts +15 -0
  99. package/undici-types/pool.d.ts +17 -0
  100. package/undici-types/proxy-agent.d.ts +16 -0
  101. package/undici-types/readable.d.ts +15 -0
  102. package/undici-types/retry-agent.d.ts +15 -0
  103. package/undici-types/retry-handler.d.ts +24 -0
  104. package/undici-types/snapshot-agent.d.ts +125 -0
  105. package/undici-types/util.d.ts +15 -0
  106. package/undici-types/utility.d.ts +15 -0
  107. package/undici-types/webidl.d.ts +126 -36
  108. package/undici-types/websocket.d.ts +18 -1
  109. package/url.d.ts +107 -587
  110. package/util/types.d.ts +571 -0
  111. package/util.d.ts +158 -792
  112. package/v8.d.ts +82 -7
  113. package/vm.d.ts +267 -108
  114. package/wasi.d.ts +38 -2
  115. package/web-globals/abortcontroller.d.ts +75 -0
  116. package/web-globals/blob.d.ts +39 -0
  117. package/web-globals/console.d.ts +25 -0
  118. package/web-globals/crypto.d.ts +55 -0
  119. package/web-globals/domexception.d.ts +84 -0
  120. package/web-globals/encoding.d.ts +27 -0
  121. package/{dom-events.d.ts → web-globals/events.d.ts} +72 -50
  122. package/web-globals/fetch.d.ts +70 -0
  123. package/web-globals/importmeta.d.ts +29 -0
  124. package/web-globals/messaging.d.ts +39 -0
  125. package/web-globals/navigator.d.ts +41 -0
  126. package/web-globals/performance.d.ts +61 -0
  127. package/web-globals/storage.d.ts +40 -0
  128. package/web-globals/streams.d.ts +131 -0
  129. package/web-globals/timers.d.ts +60 -0
  130. package/web-globals/url.d.ts +40 -0
  131. package/worker_threads.d.ts +306 -349
  132. package/zlib.d.ts +59 -94
  133. package/ts5.1/compatibility/disposable.d.ts +0 -13
  134. package/ts5.1/index.d.ts +0 -100
package/fs/promises.d.ts CHANGED
@@ -1,3 +1,18 @@
1
+ // biome-ignore-all lint: generated file
2
+ // biome-ignore-all assist: generated file
3
+ /* eslint-disable */
4
+ // @ts-ignore
5
+
6
+ /******************************************************************************
7
+ * GENERATED FILE, DO NOT MODIFY
8
+ * 这是生成的文件,千万不要修改
9
+ *
10
+ * @build-script/codegen - The Simple Code Generater
11
+ * https://github.com/GongT/baobao
12
+ *
13
+ ******************************************************************************/
14
+
15
+
1
16
  /**
2
17
  * The `fs/promises` API provides asynchronous file system methods that return
3
18
  * promises.
@@ -10,9 +25,9 @@
10
25
  */
11
26
 
12
27
  declare module "node:fs/promises" {
28
+ import { NonSharedBuffer } from 'node:buffer';
13
29
  import { Abortable } from 'node:events';
14
- import { Stream } from 'node:stream';
15
- import { ReadableStream } from 'node:stream/web';
30
+ import { Interface as ReadlineInterface } from '_not-use-node-type_readline';
16
31
  import {
17
32
  BigIntStats,
18
33
  BigIntStatsFs,
@@ -21,6 +36,7 @@ declare module "node:fs/promises" {
21
36
  CopyOptions,
22
37
  Dir,
23
38
  Dirent,
39
+ EncodingOption,
24
40
  GlobOptions,
25
41
  GlobOptionsWithFileTypes,
26
42
  GlobOptionsWithoutFileTypes,
@@ -30,10 +46,11 @@ declare module "node:fs/promises" {
30
46
  OpenDirOptions,
31
47
  OpenMode,
32
48
  PathLike,
49
+ ReadOptions,
50
+ ReadOptionsWithBuffer,
33
51
  ReadPosition,
34
52
  ReadStream,
35
53
  ReadVResult,
36
- RmDirOptions,
37
54
  RmOptions,
38
55
  StatFsOptions,
39
56
  StatOptions,
@@ -41,11 +58,12 @@ declare module "node:fs/promises" {
41
58
  StatsFs,
42
59
  TimeLike,
43
60
  WatchEventType,
44
- WatchOptions,
61
+ WatchOptions as _WatchOptions,
45
62
  WriteStream,
46
63
  WriteVResult,
47
64
  } from '_not-use-node-type_fs';
48
- import { Interface as ReadlineInterface } from '_not-use-node-type_readline';
65
+ import { Stream } from 'node:stream';
66
+ import { ReadableStream } from 'node:stream/web';
49
67
  interface FileChangeInfo<T extends string | Buffer> {
50
68
  eventType: WatchEventType;
51
69
  filename: T | null;
@@ -58,6 +76,7 @@ declare module "node:fs/promises" {
58
76
  bytesRead: number;
59
77
  buffer: T;
60
78
  }
79
+ /** @deprecated This interface will be removed in a future version. Use `import { ReadOptionsWithBuffer } from "node:fs"` instead. */
61
80
  interface FileReadOptions<T extends NodeJS.ArrayBufferView = Buffer> {
62
81
  /**
63
82
  * @default `Buffer.alloc(0xffff)`
@@ -89,6 +108,9 @@ declare module "node:fs/promises" {
89
108
  highWaterMark?: number | undefined;
90
109
  flush?: boolean | undefined;
91
110
  }
111
+ interface ReadableWebStreamOptions {
112
+ autoClose?: boolean | undefined;
113
+ }
92
114
  // TODO: Add `EventEmitter` close
93
115
  interface FileHandle {
94
116
  /**
@@ -233,11 +255,13 @@ declare module "node:fs/promises" {
233
255
  length?: number | null,
234
256
  position?: ReadPosition | null,
235
257
  ): Promise<FileReadResult<T>>;
236
- read<T extends NodeJS.ArrayBufferView = Buffer>(
258
+ read<T extends NodeJS.ArrayBufferView>(
237
259
  buffer: T,
238
- options?: FileReadOptions<T>,
260
+ options?: ReadOptions,
261
+ ): Promise<FileReadResult<T>>;
262
+ read<T extends NodeJS.ArrayBufferView = NonSharedBuffer>(
263
+ options?: ReadOptionsWithBuffer<T>,
239
264
  ): Promise<FileReadResult<T>>;
240
- read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
241
265
  /**
242
266
  * Returns a byte-oriented `ReadableStream` that may be used to read the file's
243
267
  * contents.
@@ -262,7 +286,7 @@ declare module "node:fs/promises" {
262
286
  * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method.
263
287
  * @since v17.0.0
264
288
  */
265
- readableWebStream(): ReadableStream;
289
+ readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
266
290
  /**
267
291
  * Asynchronously reads the entire contents of a file.
268
292
  *
@@ -281,7 +305,7 @@ declare module "node:fs/promises" {
281
305
  options?:
282
306
  | ({ encoding?: null | undefined } & Abortable)
283
307
  | null,
284
- ): Promise<Buffer>;
308
+ ): Promise<NonSharedBuffer>;
285
309
  /**
286
310
  * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
287
311
  * The `FileHandle` must have been opened for reading.
@@ -300,7 +324,7 @@ declare module "node:fs/promises" {
300
324
  | (ObjectEncodingOptions & Abortable)
301
325
  | BufferEncoding
302
326
  | null,
303
- ): Promise<string | Buffer>;
327
+ ): Promise<string | NonSharedBuffer>;
304
328
  /**
305
329
  * Convenience method to create a `readline` interface and stream over the file.
306
330
  * See `filehandle.createReadStream()` for the options.
@@ -409,7 +433,7 @@ declare module "node:fs/promises" {
409
433
  * @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current
410
434
  * position. See the POSIX pwrite(2) documentation for more detail.
411
435
  */
412
- write<TBuffer extends Uint8Array>(
436
+ write<TBuffer extends NodeJS.ArrayBufferView>(
413
437
  buffer: TBuffer,
414
438
  offset?: number | null,
415
439
  length?: number | null,
@@ -448,14 +472,20 @@ declare module "node:fs/promises" {
448
472
  * @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current
449
473
  * position.
450
474
  */
451
- writev(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
475
+ writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
476
+ buffers: TBuffers,
477
+ position?: number,
478
+ ): Promise<WriteVResult<TBuffers>>;
452
479
  /**
453
480
  * Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
454
481
  * @since v13.13.0, v12.17.0
455
482
  * @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position.
456
483
  * @return Fulfills upon success an object containing two properties:
457
484
  */
458
- readv(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
485
+ readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
486
+ buffers: TBuffers,
487
+ position?: number,
488
+ ): Promise<ReadVResult<TBuffers>>;
459
489
  /**
460
490
  * Closes the file handle after waiting for any pending operation on the handle to
461
491
  * complete.
@@ -475,8 +505,9 @@ declare module "node:fs/promises" {
475
505
  */
476
506
  close(): Promise<void>;
477
507
  /**
478
- * An alias for {@link FileHandle.close()}.
479
- * @since v20.4.0
508
+ * Calls `filehandle.close()` and returns a promise that fulfills when the
509
+ * filehandle is closed.
510
+ * @since v20.4.0, v18.8.0
480
511
  */
481
512
  [Symbol.asyncDispose](): Promise<void>;
482
513
  }
@@ -585,7 +616,7 @@ declare module "node:fs/promises" {
585
616
  * @since v10.0.0
586
617
  * @return Fulfills with `undefined` upon success.
587
618
  */
588
- function rmdir(path: PathLike, options?: RmDirOptions): Promise<void>;
619
+ function rmdir(path: PathLike): Promise<void>;
589
620
  /**
590
621
  * Removes files and directories (modeled on the standard POSIX `rm` utility).
591
622
  * @since v14.14.0
@@ -691,7 +722,7 @@ declare module "node:fs/promises" {
691
722
  recursive?: boolean | undefined;
692
723
  }
693
724
  | "buffer",
694
- ): Promise<Buffer[]>;
725
+ ): Promise<NonSharedBuffer[]>;
695
726
  /**
696
727
  * Asynchronous readdir(3) - read a directory.
697
728
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -706,7 +737,7 @@ declare module "node:fs/promises" {
706
737
  })
707
738
  | BufferEncoding
708
739
  | null,
709
- ): Promise<string[] | Buffer[]>;
740
+ ): Promise<string[] | NonSharedBuffer[]>;
710
741
  /**
711
742
  * Asynchronous readdir(3) - read a directory.
712
743
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -731,7 +762,7 @@ declare module "node:fs/promises" {
731
762
  withFileTypes: true;
732
763
  recursive?: boolean | undefined;
733
764
  },
734
- ): Promise<Dirent<Buffer>[]>;
765
+ ): Promise<Dirent<NonSharedBuffer>[]>;
735
766
  /**
736
767
  * Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is
737
768
  * fulfilled with the`linkString` upon success.
@@ -749,13 +780,16 @@ declare module "node:fs/promises" {
749
780
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
750
781
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
751
782
  */
752
- function readlink(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
783
+ function readlink(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
753
784
  /**
754
785
  * Asynchronous readlink(2) - read value of a symbolic link.
755
786
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
756
787
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
757
788
  */
758
- function readlink(path: PathLike, options?: ObjectEncodingOptions | string | null): Promise<string | Buffer>;
789
+ function readlink(
790
+ path: PathLike,
791
+ options?: ObjectEncodingOptions | string | null,
792
+ ): Promise<string | NonSharedBuffer>;
759
793
  /**
760
794
  * Creates a symbolic link.
761
795
  *
@@ -906,7 +940,7 @@ declare module "node:fs/promises" {
906
940
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
907
941
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
908
942
  */
909
- function realpath(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
943
+ function realpath(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
910
944
  /**
911
945
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
912
946
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -915,7 +949,7 @@ declare module "node:fs/promises" {
915
949
  function realpath(
916
950
  path: PathLike,
917
951
  options?: ObjectEncodingOptions | BufferEncoding | null,
918
- ): Promise<string | Buffer>;
952
+ ): Promise<string | NonSharedBuffer>;
919
953
  /**
920
954
  * Creates a unique temporary directory. A unique directory name is generated by
921
955
  * appending six random characters to the end of the provided `prefix`. Due to
@@ -951,13 +985,50 @@ declare module "node:fs/promises" {
951
985
  * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
952
986
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
953
987
  */
954
- function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<Buffer>;
988
+ function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
955
989
  /**
956
990
  * Asynchronously creates a unique temporary directory.
957
991
  * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
958
992
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
959
993
  */
960
- function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
994
+ function mkdtemp(
995
+ prefix: string,
996
+ options?: ObjectEncodingOptions | BufferEncoding | null,
997
+ ): Promise<string | NonSharedBuffer>;
998
+ interface DisposableTempDir extends AsyncDisposable {
999
+ /**
1000
+ * The path of the created directory.
1001
+ */
1002
+ path: string;
1003
+ /**
1004
+ * A function which removes the created directory.
1005
+ */
1006
+ remove(): Promise<void>;
1007
+ /**
1008
+ * The same as `remove`.
1009
+ */
1010
+ [Symbol.asyncDispose](): Promise<void>;
1011
+ }
1012
+ /**
1013
+ * The resulting Promise holds an async-disposable object whose `path` property
1014
+ * holds the created directory path. When the object is disposed, the directory
1015
+ * and its contents will be removed asynchronously if it still exists. If the
1016
+ * directory cannot be deleted, disposal will throw an error. The object has an
1017
+ * async `remove()` method which will perform the same task.
1018
+ *
1019
+ * Both this function and the disposal function on the resulting object are
1020
+ * async, so it should be used with `await` + `await using` as in
1021
+ * `await using dir = await fsPromises.mkdtempDisposable('prefix')`.
1022
+ *
1023
+ * <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
1024
+ *
1025
+ * For detailed information, see the documentation of `fsPromises.mkdtemp()`.
1026
+ *
1027
+ * The optional `options` argument can be a string specifying an encoding, or an
1028
+ * object with an `encoding` property specifying the character encoding to use.
1029
+ * @since v24.4.0
1030
+ */
1031
+ function mkdtempDisposable(prefix: PathLike, options?: EncodingOption): Promise<DisposableTempDir>;
961
1032
  /**
962
1033
  * Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
963
1034
  * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
@@ -1113,7 +1184,7 @@ declare module "node:fs/promises" {
1113
1184
  flag?: OpenMode | undefined;
1114
1185
  } & Abortable)
1115
1186
  | null,
1116
- ): Promise<Buffer>;
1187
+ ): Promise<NonSharedBuffer>;
1117
1188
  /**
1118
1189
  * Asynchronously reads the entire contents of a file.
1119
1190
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1149,7 +1220,7 @@ declare module "node:fs/promises" {
1149
1220
  )
1150
1221
  | BufferEncoding
1151
1222
  | null,
1152
- ): Promise<string | Buffer>;
1223
+ ): Promise<string | NonSharedBuffer>;
1153
1224
  /**
1154
1225
  * Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
1155
1226
  *
@@ -1179,6 +1250,16 @@ declare module "node:fs/promises" {
1179
1250
  * @return Fulfills with an {fs.Dir}.
1180
1251
  */
1181
1252
  function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
1253
+ interface WatchOptions extends _WatchOptions {
1254
+ maxQueue?: number | undefined;
1255
+ overflow?: "ignore" | "throw" | undefined;
1256
+ }
1257
+ interface WatchOptionsWithBufferEncoding extends WatchOptions {
1258
+ encoding: "buffer";
1259
+ }
1260
+ interface WatchOptionsWithStringEncoding extends WatchOptions {
1261
+ encoding?: BufferEncoding | undefined;
1262
+ }
1182
1263
  /**
1183
1264
  * Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
1184
1265
  *
@@ -1211,33 +1292,16 @@ declare module "node:fs/promises" {
1211
1292
  */
1212
1293
  function watch(
1213
1294
  filename: PathLike,
1214
- options:
1215
- | (WatchOptions & {
1216
- encoding: "buffer";
1217
- })
1218
- | "buffer",
1219
- ): AsyncIterable<FileChangeInfo<Buffer>>;
1220
- /**
1221
- * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1222
- * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1223
- * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
1224
- * If `encoding` is not supplied, the default of `'utf8'` is used.
1225
- * If `persistent` is not supplied, the default of `true` is used.
1226
- * If `recursive` is not supplied, the default of `false` is used.
1227
- */
1228
- function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable<FileChangeInfo<string>>;
1229
- /**
1230
- * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1231
- * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1232
- * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
1233
- * If `encoding` is not supplied, the default of `'utf8'` is used.
1234
- * If `persistent` is not supplied, the default of `true` is used.
1235
- * If `recursive` is not supplied, the default of `false` is used.
1236
- */
1295
+ options?: WatchOptionsWithStringEncoding | BufferEncoding,
1296
+ ): NodeJS.AsyncIterator<FileChangeInfo<string>>;
1297
+ function watch(
1298
+ filename: PathLike,
1299
+ options: WatchOptionsWithBufferEncoding | "buffer",
1300
+ ): NodeJS.AsyncIterator<FileChangeInfo<NonSharedBuffer>>;
1237
1301
  function watch(
1238
1302
  filename: PathLike,
1239
- options: WatchOptions | string,
1240
- ): AsyncIterable<FileChangeInfo<string>> | AsyncIterable<FileChangeInfo<Buffer>>;
1303
+ options: WatchOptions | BufferEncoding | "buffer",
1304
+ ): NodeJS.AsyncIterator<FileChangeInfo<string | NonSharedBuffer>>;
1241
1305
  /**
1242
1306
  * Asynchronously copies the entire directory structure from `src` to `dest`,
1243
1307
  * including subdirectories and files.