diff --git a/flow-typed/environment/node.js b/flow-typed/environment/node.js index 5cda45bd18fc..dce7b718159a 100644 --- a/flow-typed/environment/node.js +++ b/flow-typed/environment/node.js @@ -2539,7 +2539,14 @@ declare class stream$Readable extends stream$Stream { static from( iterable: Iterable | AsyncIterable, options?: readableStreamOptions, - ): stream$Readable; + ): this; + + static fromWeb( + readableStream: ReadableStream, + options?: readableStreamOptions, + ): this; + + static toWeb(streamReadable: stream$Readable): ReadableStream; constructor(options?: readableStreamOptions): void; destroy(error?: Error): this; @@ -2586,6 +2593,13 @@ type writableStreamOptions = { ... }; declare class stream$Writable extends stream$Stream { + static fromWeb( + writableStream: WritableStream, + options?: writableStreamOptions, + ): this; + + static toWeb(streamWritable: stream$Writable): WritableStream; + constructor(options?: writableStreamOptions): void; cork(): void; destroy(error?: Error): this; @@ -2627,10 +2641,6 @@ declare class stream$Writable extends stream$Stream { _final(callback: (error?: Error) => void): void; } -//According to the NodeJS docs: -//"Since JavaScript doesn't have multiple prototypal inheritance, this class -//prototypally inherits from Readable, and then parasitically from Writable." -//Source: , + options?: duplexStreamOptions, + ): this; + + // $FlowFixMe[incompatible-type] See above + static toWeb(streamDuplex: stream$Duplex): { + readable: ReadableStream, + writable: WritableStream, + ... + }; + constructor(options?: duplexStreamOptions): void; } type transformStreamOptions = duplexStreamOptions & {