@@ -2539,7 +2539,14 @@ declare class stream$Readable extends stream$Stream {
25392539 static from (
25402540 iterable : Iterable < any > | AsyncIterable < any > ,
25412541 options ?: readableStreamOptions ,
2542- ) : stream$Readable ;
2542+ ) : this ;
2543+
2544+ static fromWeb (
2545+ readableStream : ReadableStream ,
2546+ options ?: readableStreamOptions ,
2547+ ) : this ;
2548+
2549+ static toWeb ( streamReadable : stream$Readable ) : ReadableStream ;
25432550
25442551 constructor ( options ?: readableStreamOptions ) : void ;
25452552 destroy ( error ? : Error ) : this ;
@@ -2586,6 +2593,13 @@ type writableStreamOptions = {
25862593 ...
25872594} ;
25882595declare class stream$Writable extends stream$Stream {
2596+ static fromWeb (
2597+ writableStream : WritableStream ,
2598+ options ?: writableStreamOptions ,
2599+ ) : this ;
2600+
2601+ static toWeb ( streamWritable : stream$Writable ) : WritableStream ;
2602+
25892603 constructor ( options ?: writableStreamOptions ) : void ;
25902604 cork ( ) : void ;
25912605 destroy ( error ? : Error ) : this ;
@@ -2627,10 +2641,6 @@ declare class stream$Writable extends stream$Stream {
26272641 _final ( callback : ( error ? : Error ) = > void ) : void ;
26282642}
26292643
2630- //According to the NodeJS docs:
2631- //"Since JavaScript doesn't have multiple prototypal inheritance, this class
2632- //prototypally inherits from Readable, and then parasitically from Writable."
2633- //Source: <https://nodejs.org/api/stream.html#stream_class_stream_duplex_1
26342644type duplexStreamOptions = writableStreamOptions &
26352645 readableStreamOptions & {
26362646 allowHalfOpen ?: boolean ,
@@ -2641,6 +2651,28 @@ type duplexStreamOptions = writableStreamOptions &
26412651 ...
26422652 } ;
26432653declare class stream$Duplex extends stream$Readable mixins stream$Writable {
2654+ // This is an unusual class at runtime, per the docs it "prototypally extends from Readable,
2655+ // and then parasitically from Writable." Its static methods have incompatible signatures
2656+ // with Readable's, which Flow doesn't like.
2657+ // See https://nodejs.org/api/stream.html#stream_class_stream_duplex_1
2658+
2659+ // $FlowFixMe[incompatible-exact] See above
2660+ // $FlowFixMe[incompatible-type] See above
2661+ static fromWeb (
2662+ pair : $ReadOnly < {
2663+ readable : ReadableStream ,
2664+ writable : WritableStream ,
2665+ } > ,
2666+ options ?: duplexStreamOptions ,
2667+ ) : this ;
2668+
2669+ // $FlowFixMe[incompatible-type] See above
2670+ static toWeb ( streamDuplex : stream$Duplex ) : {
2671+ readable: ReadableStream ,
2672+ writable : WritableStream ,
2673+ ...
2674+ } ;
2675+
26442676 constructor ( options ? : duplexStreamOptions ) : void ;
26452677}
26462678type transformStreamOptions = duplexStreamOptions & {
0 commit comments