405911970efb553143f75a3122539681c1bafd7282934892c8447d97210e17fc7a04ba48bb53bef8a14897d50df0af36fd9e840060b354ba47f13bfa05fa98 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. type _ByteLengthQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
  2. : import("stream/web").ByteLengthQueuingStrategy;
  3. type _CompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
  4. : import("stream/web").CompressionStream;
  5. type _CountQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
  6. : import("stream/web").CountQueuingStrategy;
  7. type _DecompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
  8. : import("stream/web").DecompressionStream;
  9. type _QueuingStrategy<T = any> = typeof globalThis extends { onmessage: any } ? {}
  10. : import("stream/web").QueuingStrategy<T>;
  11. type _ReadableByteStreamController = typeof globalThis extends { onmessage: any } ? {}
  12. : import("stream/web").ReadableByteStreamController;
  13. type _ReadableStream<R = any> = typeof globalThis extends { onmessage: any } ? {}
  14. : import("stream/web").ReadableStream<R>;
  15. type _ReadableStreamBYOBReader = typeof globalThis extends { onmessage: any } ? {}
  16. : import("stream/web").ReadableStreamBYOBReader;
  17. type _ReadableStreamBYOBRequest = typeof globalThis extends { onmessage: any } ? {}
  18. : import("stream/web").ReadableStreamBYOBRequest;
  19. type _ReadableStreamDefaultController<R = any> = typeof globalThis extends { onmessage: any } ? {}
  20. : import("stream/web").ReadableStreamDefaultController<R>;
  21. type _ReadableStreamDefaultReader<R = any> = typeof globalThis extends { onmessage: any } ? {}
  22. : import("stream/web").ReadableStreamDefaultReader<R>;
  23. type _TextDecoderStream = typeof globalThis extends { onmessage: any } ? {}
  24. : import("stream/web").TextDecoderStream;
  25. type _TextEncoderStream = typeof globalThis extends { onmessage: any } ? {}
  26. : import("stream/web").TextEncoderStream;
  27. type _TransformStream<I = any, O = any> = typeof globalThis extends { onmessage: any } ? {}
  28. : import("stream/web").TransformStream<I, O>;
  29. type _TransformStreamDefaultController<O = any> = typeof globalThis extends { onmessage: any } ? {}
  30. : import("stream/web").TransformStreamDefaultController<O>;
  31. type _WritableStream<W = any> = typeof globalThis extends { onmessage: any } ? {}
  32. : import("stream/web").WritableStream<W>;
  33. type _WritableStreamDefaultController = typeof globalThis extends { onmessage: any } ? {}
  34. : import("stream/web").WritableStreamDefaultController;
  35. type _WritableStreamDefaultWriter<W = any> = typeof globalThis extends { onmessage: any } ? {}
  36. : import("stream/web").WritableStreamDefaultWriter<W>;
  37. declare module "stream/web" {
  38. // stub module, pending copy&paste from .d.ts or manual impl
  39. // copy from lib.dom.d.ts
  40. interface ReadableWritablePair<R = any, W = any> {
  41. readable: ReadableStream<R>;
  42. /**
  43. * Provides a convenient, chainable way of piping this readable stream
  44. * through a transform stream (or any other { writable, readable }
  45. * pair). It simply pipes the stream into the writable side of the
  46. * supplied pair, and returns the readable side for further use.
  47. *
  48. * Piping a stream will lock it for the duration of the pipe, preventing
  49. * any other consumer from acquiring a reader.
  50. */
  51. writable: WritableStream<W>;
  52. }
  53. interface StreamPipeOptions {
  54. preventAbort?: boolean;
  55. preventCancel?: boolean;
  56. /**
  57. * Pipes this readable stream to a given writable stream destination.
  58. * The way in which the piping process behaves under various error
  59. * conditions can be customized with a number of passed options. It
  60. * returns a promise that fulfills when the piping process completes
  61. * successfully, or rejects if any errors were encountered.
  62. *
  63. * Piping a stream will lock it for the duration of the pipe, preventing
  64. * any other consumer from acquiring a reader.
  65. *
  66. * Errors and closures of the source and destination streams propagate
  67. * as follows:
  68. *
  69. * An error in this source readable stream will abort destination,
  70. * unless preventAbort is truthy. The returned promise will be rejected
  71. * with the source's error, or with any error that occurs during
  72. * aborting the destination.
  73. *
  74. * An error in destination will cancel this source readable stream,
  75. * unless preventCancel is truthy. The returned promise will be rejected
  76. * with the destination's error, or with any error that occurs during
  77. * canceling the source.
  78. *
  79. * When this source readable stream closes, destination will be closed,
  80. * unless preventClose is truthy. The returned promise will be fulfilled
  81. * once this process completes, unless an error is encountered while
  82. * closing the destination, in which case it will be rejected with that
  83. * error.
  84. *
  85. * If destination starts out closed or closing, this source readable
  86. * stream will be canceled, unless preventCancel is true. The returned
  87. * promise will be rejected with an error indicating piping to a closed
  88. * stream failed, or with any error that occurs during canceling the
  89. * source.
  90. *
  91. * The signal option can be set to an AbortSignal to allow aborting an
  92. * ongoing pipe operation via the corresponding AbortController. In this
  93. * case, this source readable stream will be canceled, and destination
  94. * aborted, unless the respective options preventCancel or preventAbort
  95. * are set.
  96. */
  97. preventClose?: boolean;
  98. signal?: AbortSignal;
  99. }
  100. interface ReadableStreamGenericReader {
  101. readonly closed: Promise<void>;
  102. cancel(reason?: any): Promise<void>;
  103. }
  104. type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
  105. interface ReadableStreamReadValueResult<T> {
  106. done: false;
  107. value: T;
  108. }
  109. interface ReadableStreamReadDoneResult<T> {
  110. done: true;
  111. value?: T;
  112. }
  113. type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
  114. interface ReadableByteStreamControllerCallback {
  115. (controller: ReadableByteStreamController): void | PromiseLike<void>;
  116. }
  117. interface UnderlyingSinkAbortCallback {
  118. (reason?: any): void | PromiseLike<void>;
  119. }
  120. interface UnderlyingSinkCloseCallback {
  121. (): void | PromiseLike<void>;
  122. }
  123. interface UnderlyingSinkStartCallback {
  124. (controller: WritableStreamDefaultController): any;
  125. }
  126. interface UnderlyingSinkWriteCallback<W> {
  127. (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
  128. }
  129. interface UnderlyingSourceCancelCallback {
  130. (reason?: any): void | PromiseLike<void>;
  131. }
  132. interface UnderlyingSourcePullCallback<R> {
  133. (controller: ReadableStreamController<R>): void | PromiseLike<void>;
  134. }
  135. interface UnderlyingSourceStartCallback<R> {
  136. (controller: ReadableStreamController<R>): any;
  137. }
  138. interface TransformerFlushCallback<O> {
  139. (controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
  140. }
  141. interface TransformerStartCallback<O> {
  142. (controller: TransformStreamDefaultController<O>): any;
  143. }
  144. interface TransformerTransformCallback<I, O> {
  145. (chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
  146. }
  147. interface TransformerCancelCallback {
  148. (reason: any): void | PromiseLike<void>;
  149. }
  150. interface UnderlyingByteSource {
  151. autoAllocateChunkSize?: number;
  152. cancel?: ReadableStreamErrorCallback;
  153. pull?: ReadableByteStreamControllerCallback;
  154. start?: ReadableByteStreamControllerCallback;
  155. type: "bytes";
  156. }
  157. interface UnderlyingSource<R = any> {
  158. cancel?: UnderlyingSourceCancelCallback;
  159. pull?: UnderlyingSourcePullCallback<R>;
  160. start?: UnderlyingSourceStartCallback<R>;
  161. type?: undefined;
  162. }
  163. interface UnderlyingSink<W = any> {
  164. abort?: UnderlyingSinkAbortCallback;
  165. close?: UnderlyingSinkCloseCallback;
  166. start?: UnderlyingSinkStartCallback;
  167. type?: undefined;
  168. write?: UnderlyingSinkWriteCallback<W>;
  169. }
  170. interface ReadableStreamErrorCallback {
  171. (reason: any): void | PromiseLike<void>;
  172. }
  173. interface ReadableStreamAsyncIterator<T> extends NodeJS.AsyncIterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
  174. [Symbol.asyncIterator](): ReadableStreamAsyncIterator<T>;
  175. }
  176. /** This Streams API interface represents a readable stream of byte data. */
  177. interface ReadableStream<R = any> {
  178. readonly locked: boolean;
  179. cancel(reason?: any): Promise<void>;
  180. getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
  181. getReader(): ReadableStreamDefaultReader<R>;
  182. getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader<R>;
  183. pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
  184. pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
  185. tee(): [ReadableStream<R>, ReadableStream<R>];
  186. values(options?: { preventCancel?: boolean }): ReadableStreamAsyncIterator<R>;
  187. [Symbol.asyncIterator](): ReadableStreamAsyncIterator<R>;
  188. }
  189. const ReadableStream: {
  190. prototype: ReadableStream;
  191. from<T>(iterable: Iterable<T> | AsyncIterable<T>): ReadableStream<T>;
  192. new(underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
  193. new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
  194. };
  195. type ReadableStreamReaderMode = "byob";
  196. interface ReadableStreamGetReaderOptions {
  197. /**
  198. * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
  199. *
  200. * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.
  201. */
  202. mode?: ReadableStreamReaderMode;
  203. }
  204. type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBYOBReader;
  205. interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
  206. read(): Promise<ReadableStreamReadResult<R>>;
  207. releaseLock(): void;
  208. }
  209. /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */
  210. interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
  211. /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
  212. read<T extends ArrayBufferView>(
  213. view: T,
  214. options?: {
  215. min?: number;
  216. },
  217. ): Promise<ReadableStreamReadResult<T>>;
  218. /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
  219. releaseLock(): void;
  220. }
  221. const ReadableStreamDefaultReader: {
  222. prototype: ReadableStreamDefaultReader;
  223. new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
  224. };
  225. const ReadableStreamBYOBReader: {
  226. prototype: ReadableStreamBYOBReader;
  227. new(stream: ReadableStream): ReadableStreamBYOBReader;
  228. };
  229. /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
  230. interface ReadableStreamBYOBRequest {
  231. /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
  232. readonly view: ArrayBufferView | null;
  233. /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
  234. respond(bytesWritten: number): void;
  235. /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
  236. respondWithNewView(view: ArrayBufferView): void;
  237. }
  238. const ReadableStreamBYOBRequest: {
  239. prototype: ReadableStreamBYOBRequest;
  240. new(): ReadableStreamBYOBRequest;
  241. };
  242. interface ReadableByteStreamController {
  243. readonly byobRequest: undefined;
  244. readonly desiredSize: number | null;
  245. close(): void;
  246. enqueue(chunk: ArrayBufferView): void;
  247. error(error?: any): void;
  248. }
  249. const ReadableByteStreamController: {
  250. prototype: ReadableByteStreamController;
  251. new(): ReadableByteStreamController;
  252. };
  253. interface ReadableStreamDefaultController<R = any> {
  254. readonly desiredSize: number | null;
  255. close(): void;
  256. enqueue(chunk?: R): void;
  257. error(e?: any): void;
  258. }
  259. const ReadableStreamDefaultController: {
  260. prototype: ReadableStreamDefaultController;
  261. new(): ReadableStreamDefaultController;
  262. };
  263. interface Transformer<I = any, O = any> {
  264. flush?: TransformerFlushCallback<O>;
  265. readableType?: undefined;
  266. start?: TransformerStartCallback<O>;
  267. transform?: TransformerTransformCallback<I, O>;
  268. cancel?: TransformerCancelCallback;
  269. writableType?: undefined;
  270. }
  271. interface TransformStream<I = any, O = any> {
  272. readonly readable: ReadableStream<O>;
  273. readonly writable: WritableStream<I>;
  274. }
  275. const TransformStream: {
  276. prototype: TransformStream;
  277. new<I = any, O = any>(
  278. transformer?: Transformer<I, O>,
  279. writableStrategy?: QueuingStrategy<I>,
  280. readableStrategy?: QueuingStrategy<O>,
  281. ): TransformStream<I, O>;
  282. };
  283. interface TransformStreamDefaultController<O = any> {
  284. readonly desiredSize: number | null;
  285. enqueue(chunk?: O): void;
  286. error(reason?: any): void;
  287. terminate(): void;
  288. }
  289. const TransformStreamDefaultController: {
  290. prototype: TransformStreamDefaultController;
  291. new(): TransformStreamDefaultController;
  292. };
  293. /**
  294. * This Streams API interface provides a standard abstraction for writing
  295. * streaming data to a destination, known as a sink. This object comes with
  296. * built-in back pressure and queuing.
  297. */
  298. interface WritableStream<W = any> {
  299. readonly locked: boolean;
  300. abort(reason?: any): Promise<void>;
  301. close(): Promise<void>;
  302. getWriter(): WritableStreamDefaultWriter<W>;
  303. }
  304. const WritableStream: {
  305. prototype: WritableStream;
  306. new<W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
  307. };
  308. /**
  309. * This Streams API interface is the object returned by
  310. * WritableStream.getWriter() and once created locks the < writer to the
  311. * WritableStream ensuring that no other streams can write to the underlying
  312. * sink.
  313. */
  314. interface WritableStreamDefaultWriter<W = any> {
  315. readonly closed: Promise<void>;
  316. readonly desiredSize: number | null;
  317. readonly ready: Promise<void>;
  318. abort(reason?: any): Promise<void>;
  319. close(): Promise<void>;
  320. releaseLock(): void;
  321. write(chunk?: W): Promise<void>;
  322. }
  323. const WritableStreamDefaultWriter: {
  324. prototype: WritableStreamDefaultWriter;
  325. new<W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
  326. };
  327. /**
  328. * This Streams API interface represents a controller allowing control of a
  329. * WritableStream's state. When constructing a WritableStream, the
  330. * underlying sink is given a corresponding WritableStreamDefaultController
  331. * instance to manipulate.
  332. */
  333. interface WritableStreamDefaultController {
  334. error(e?: any): void;
  335. }
  336. const WritableStreamDefaultController: {
  337. prototype: WritableStreamDefaultController;
  338. new(): WritableStreamDefaultController;
  339. };
  340. interface QueuingStrategy<T = any> {
  341. highWaterMark?: number;
  342. size?: QueuingStrategySize<T>;
  343. }
  344. interface QueuingStrategySize<T = any> {
  345. (chunk?: T): number;
  346. }
  347. interface QueuingStrategyInit {
  348. /**
  349. * Creates a new ByteLengthQueuingStrategy with the provided high water
  350. * mark.
  351. *
  352. * Note that the provided high water mark will not be validated ahead of
  353. * time. Instead, if it is negative, NaN, or not a number, the resulting
  354. * ByteLengthQueuingStrategy will cause the corresponding stream
  355. * constructor to throw.
  356. */
  357. highWaterMark: number;
  358. }
  359. /**
  360. * This Streams API interface provides a built-in byte length queuing
  361. * strategy that can be used when constructing streams.
  362. */
  363. interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
  364. readonly highWaterMark: number;
  365. readonly size: QueuingStrategySize<ArrayBufferView>;
  366. }
  367. const ByteLengthQueuingStrategy: {
  368. prototype: ByteLengthQueuingStrategy;
  369. new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
  370. };
  371. /**
  372. * This Streams API interface provides a built-in byte length queuing
  373. * strategy that can be used when constructing streams.
  374. */
  375. interface CountQueuingStrategy extends QueuingStrategy {
  376. readonly highWaterMark: number;
  377. readonly size: QueuingStrategySize;
  378. }
  379. const CountQueuingStrategy: {
  380. prototype: CountQueuingStrategy;
  381. new(init: QueuingStrategyInit): CountQueuingStrategy;
  382. };
  383. interface TextEncoderStream {
  384. /** Returns "utf-8". */
  385. readonly encoding: "utf-8";
  386. readonly readable: ReadableStream<Uint8Array>;
  387. readonly writable: WritableStream<string>;
  388. readonly [Symbol.toStringTag]: string;
  389. }
  390. const TextEncoderStream: {
  391. prototype: TextEncoderStream;
  392. new(): TextEncoderStream;
  393. };
  394. interface TextDecoderOptions {
  395. fatal?: boolean;
  396. ignoreBOM?: boolean;
  397. }
  398. type BufferSource = ArrayBufferView | ArrayBuffer;
  399. interface TextDecoderStream {
  400. /** Returns encoding's name, lower cased. */
  401. readonly encoding: string;
  402. /** Returns `true` if error mode is "fatal", and `false` otherwise. */
  403. readonly fatal: boolean;
  404. /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */
  405. readonly ignoreBOM: boolean;
  406. readonly readable: ReadableStream<string>;
  407. readonly writable: WritableStream<BufferSource>;
  408. readonly [Symbol.toStringTag]: string;
  409. }
  410. const TextDecoderStream: {
  411. prototype: TextDecoderStream;
  412. new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream;
  413. };
  414. interface CompressionStream {
  415. readonly readable: ReadableStream;
  416. readonly writable: WritableStream;
  417. }
  418. const CompressionStream: {
  419. prototype: CompressionStream;
  420. new(format: "deflate" | "deflate-raw" | "gzip"): CompressionStream;
  421. };
  422. interface DecompressionStream {
  423. readonly writable: WritableStream;
  424. readonly readable: ReadableStream;
  425. }
  426. const DecompressionStream: {
  427. prototype: DecompressionStream;
  428. new(format: "deflate" | "deflate-raw" | "gzip"): DecompressionStream;
  429. };
  430. global {
  431. interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {}
  432. /**
  433. * `ByteLengthQueuingStrategy` class is a global reference for `import { ByteLengthQueuingStrategy } from 'node:stream/web'`.
  434. * https://nodejs.org/api/globals.html#class-bytelengthqueuingstrategy
  435. * @since v18.0.0
  436. */
  437. var ByteLengthQueuingStrategy: typeof globalThis extends { onmessage: any; ByteLengthQueuingStrategy: infer T }
  438. ? T
  439. : typeof import("stream/web").ByteLengthQueuingStrategy;
  440. interface CompressionStream extends _CompressionStream {}
  441. /**
  442. * `CompressionStream` class is a global reference for `import { CompressionStream } from 'node:stream/web'`.
  443. * https://nodejs.org/api/globals.html#class-compressionstream
  444. * @since v18.0.0
  445. */
  446. var CompressionStream: typeof globalThis extends {
  447. onmessage: any;
  448. // CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
  449. // If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
  450. ReportingObserver: any;
  451. CompressionStream: infer T;
  452. } ? T
  453. // TS 4.8, 4.9, 5.0
  454. : typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
  455. prototype: T;
  456. new(format: "deflate" | "deflate-raw" | "gzip"): T;
  457. }
  458. : typeof import("stream/web").CompressionStream;
  459. interface CountQueuingStrategy extends _CountQueuingStrategy {}
  460. /**
  461. * `CountQueuingStrategy` class is a global reference for `import { CountQueuingStrategy } from 'node:stream/web'`.
  462. * https://nodejs.org/api/globals.html#class-countqueuingstrategy
  463. * @since v18.0.0
  464. */
  465. var CountQueuingStrategy: typeof globalThis extends { onmessage: any; CountQueuingStrategy: infer T } ? T
  466. : typeof import("stream/web").CountQueuingStrategy;
  467. interface DecompressionStream extends _DecompressionStream {}
  468. /**
  469. * `DecompressionStream` class is a global reference for `import { DecompressionStream } from 'node:stream/web'`.
  470. * https://nodejs.org/api/globals.html#class-decompressionstream
  471. * @since v18.0.0
  472. */
  473. var DecompressionStream: typeof globalThis extends {
  474. onmessage: any;
  475. // CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
  476. // If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
  477. ReportingObserver: any;
  478. DecompressionStream: infer T extends object;
  479. } ? T
  480. // TS 4.8, 4.9, 5.0
  481. : typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
  482. prototype: T;
  483. new(format: "deflate" | "deflate-raw" | "gzip"): T;
  484. }
  485. : typeof import("stream/web").DecompressionStream;
  486. interface QueuingStrategy<T = any> extends _QueuingStrategy<T> {}
  487. interface ReadableByteStreamController extends _ReadableByteStreamController {}
  488. /**
  489. * `ReadableByteStreamController` class is a global reference for `import { ReadableByteStreamController } from 'node:stream/web'`.
  490. * https://nodejs.org/api/globals.html#class-readablebytestreamcontroller
  491. * @since v18.0.0
  492. */
  493. var ReadableByteStreamController: typeof globalThis extends
  494. { onmessage: any; ReadableByteStreamController: infer T } ? T
  495. : typeof import("stream/web").ReadableByteStreamController;
  496. interface ReadableStream<R = any> extends _ReadableStream<R> {}
  497. /**
  498. * `ReadableStream` class is a global reference for `import { ReadableStream } from 'node:stream/web'`.
  499. * https://nodejs.org/api/globals.html#class-readablestream
  500. * @since v18.0.0
  501. */
  502. var ReadableStream: typeof globalThis extends { onmessage: any; ReadableStream: infer T } ? T
  503. : typeof import("stream/web").ReadableStream;
  504. interface ReadableStreamBYOBReader extends _ReadableStreamBYOBReader {}
  505. /**
  506. * `ReadableStreamBYOBReader` class is a global reference for `import { ReadableStreamBYOBReader } from 'node:stream/web'`.
  507. * https://nodejs.org/api/globals.html#class-readablestreambyobreader
  508. * @since v18.0.0
  509. */
  510. var ReadableStreamBYOBReader: typeof globalThis extends { onmessage: any; ReadableStreamBYOBReader: infer T }
  511. ? T
  512. : typeof import("stream/web").ReadableStreamBYOBReader;
  513. interface ReadableStreamBYOBRequest extends _ReadableStreamBYOBRequest {}
  514. /**
  515. * `ReadableStreamBYOBRequest` class is a global reference for `import { ReadableStreamBYOBRequest } from 'node:stream/web'`.
  516. * https://nodejs.org/api/globals.html#class-readablestreambyobrequest
  517. * @since v18.0.0
  518. */
  519. var ReadableStreamBYOBRequest: typeof globalThis extends { onmessage: any; ReadableStreamBYOBRequest: infer T }
  520. ? T
  521. : typeof import("stream/web").ReadableStreamBYOBRequest;
  522. interface ReadableStreamDefaultController<R = any> extends _ReadableStreamDefaultController<R> {}
  523. /**
  524. * `ReadableStreamDefaultController` class is a global reference for `import { ReadableStreamDefaultController } from 'node:stream/web'`.
  525. * https://nodejs.org/api/globals.html#class-readablestreamdefaultcontroller
  526. * @since v18.0.0
  527. */
  528. var ReadableStreamDefaultController: typeof globalThis extends
  529. { onmessage: any; ReadableStreamDefaultController: infer T } ? T
  530. : typeof import("stream/web").ReadableStreamDefaultController;
  531. interface ReadableStreamDefaultReader<R = any> extends _ReadableStreamDefaultReader<R> {}
  532. /**
  533. * `ReadableStreamDefaultReader` class is a global reference for `import { ReadableStreamDefaultReader } from 'node:stream/web'`.
  534. * https://nodejs.org/api/globals.html#class-readablestreamdefaultreader
  535. * @since v18.0.0
  536. */
  537. var ReadableStreamDefaultReader: typeof globalThis extends
  538. { onmessage: any; ReadableStreamDefaultReader: infer T } ? T
  539. : typeof import("stream/web").ReadableStreamDefaultReader;
  540. interface TextDecoderStream extends _TextDecoderStream {}
  541. /**
  542. * `TextDecoderStream` class is a global reference for `import { TextDecoderStream } from 'node:stream/web'`.
  543. * https://nodejs.org/api/globals.html#class-textdecoderstream
  544. * @since v18.0.0
  545. */
  546. var TextDecoderStream: typeof globalThis extends { onmessage: any; TextDecoderStream: infer T } ? T
  547. : typeof import("stream/web").TextDecoderStream;
  548. interface TextEncoderStream extends _TextEncoderStream {}
  549. /**
  550. * `TextEncoderStream` class is a global reference for `import { TextEncoderStream } from 'node:stream/web'`.
  551. * https://nodejs.org/api/globals.html#class-textencoderstream
  552. * @since v18.0.0
  553. */
  554. var TextEncoderStream: typeof globalThis extends { onmessage: any; TextEncoderStream: infer T } ? T
  555. : typeof import("stream/web").TextEncoderStream;
  556. interface TransformStream<I = any, O = any> extends _TransformStream<I, O> {}
  557. /**
  558. * `TransformStream` class is a global reference for `import { TransformStream } from 'node:stream/web'`.
  559. * https://nodejs.org/api/globals.html#class-transformstream
  560. * @since v18.0.0
  561. */
  562. var TransformStream: typeof globalThis extends { onmessage: any; TransformStream: infer T } ? T
  563. : typeof import("stream/web").TransformStream;
  564. interface TransformStreamDefaultController<O = any> extends _TransformStreamDefaultController<O> {}
  565. /**
  566. * `TransformStreamDefaultController` class is a global reference for `import { TransformStreamDefaultController } from 'node:stream/web'`.
  567. * https://nodejs.org/api/globals.html#class-transformstreamdefaultcontroller
  568. * @since v18.0.0
  569. */
  570. var TransformStreamDefaultController: typeof globalThis extends
  571. { onmessage: any; TransformStreamDefaultController: infer T } ? T
  572. : typeof import("stream/web").TransformStreamDefaultController;
  573. interface WritableStream<W = any> extends _WritableStream<W> {}
  574. /**
  575. * `WritableStream` class is a global reference for `import { WritableStream } from 'node:stream/web'`.
  576. * https://nodejs.org/api/globals.html#class-writablestream
  577. * @since v18.0.0
  578. */
  579. var WritableStream: typeof globalThis extends { onmessage: any; WritableStream: infer T } ? T
  580. : typeof import("stream/web").WritableStream;
  581. interface WritableStreamDefaultController extends _WritableStreamDefaultController {}
  582. /**
  583. * `WritableStreamDefaultController` class is a global reference for `import { WritableStreamDefaultController } from 'node:stream/web'`.
  584. * https://nodejs.org/api/globals.html#class-writablestreamdefaultcontroller
  585. * @since v18.0.0
  586. */
  587. var WritableStreamDefaultController: typeof globalThis extends
  588. { onmessage: any; WritableStreamDefaultController: infer T } ? T
  589. : typeof import("stream/web").WritableStreamDefaultController;
  590. interface WritableStreamDefaultWriter<W = any> extends _WritableStreamDefaultWriter<W> {}
  591. /**
  592. * `WritableStreamDefaultWriter` class is a global reference for `import { WritableStreamDefaultWriter } from 'node:stream/web'`.
  593. * https://nodejs.org/api/globals.html#class-writablestreamdefaultwriter
  594. * @since v18.0.0
  595. */
  596. var WritableStreamDefaultWriter: typeof globalThis extends
  597. { onmessage: any; WritableStreamDefaultWriter: infer T } ? T
  598. : typeof import("stream/web").WritableStreamDefaultWriter;
  599. }
  600. }
  601. declare module "node:stream/web" {
  602. export * from "stream/web";
  603. }