@@ -101,8 +101,8 @@ const groupFunctions = (output, fn, index, fns) => {
101101const produceStreams = item => {
102102 if ( Array . isArray ( item ) ) {
103103 if ( ! item . length ) return null ;
104- if ( item . length == 1 ) return item [ 0 ] && chain . asStream ( item [ 0 ] ) ;
105- return chain . asStream ( chain . gen ( ...item ) ) ;
104+ if ( item . length == 1 ) return item [ 0 ] && /** @type { any } */ ( chain ) . asStream ( item [ 0 ] ) ;
105+ return /** @type { any } */ ( chain ) . asStream ( /** @type { any } */ ( chain ) . gen ( ...item ) ) ;
106106 }
107107 return item ;
108108} ;
@@ -124,7 +124,7 @@ const wrapFunctions = (fn, index, fns) => {
124124 if ( index === fns . length - 1 && isWritableWebStream ( fn ) ) {
125125 return Writable . fromWeb ( fn , { objectMode : true } ) ;
126126 }
127- if ( typeof fn == 'function' ) return chain . asStream ( fn ) ; // a function
127+ if ( typeof fn == 'function' ) return /** @type { any } */ ( chain ) . asStream ( fn ) ; // a function
128128 throw TypeError ( 'Item #' + index + ' is not a proper stream, nor a function.' ) ;
129129} ;
130130
@@ -193,16 +193,18 @@ const chain = (fns, options) => {
193193 output . on ( 'finish' , ( ) => stream . push ( null ) ) ;
194194 }
195195
196- stream = new Duplex ( {
197- writableObjectMode : true ,
198- readableObjectMode : true ,
199- ...options ,
200- readable : isReadableNodeStream ( output ) ,
201- writable : isWritableNodeStream ( input ) ,
202- write : writeMethod ,
203- final : finalMethod ,
204- read : readMethod
205- } ) ;
196+ stream = /** @type {Duplex & {streams: any[], input: any, output: any} } */ (
197+ new Duplex ( {
198+ writableObjectMode : true ,
199+ readableObjectMode : true ,
200+ ...options ,
201+ readable : isReadableNodeStream ( output ) ,
202+ writable : isWritableNodeStream ( input ) ,
203+ write : writeMethod ,
204+ final : finalMethod ,
205+ read : readMethod
206+ } )
207+ ) ;
206208 stream . streams = streams ;
207209 stream . input = input ;
208210 stream . output = output ;
0 commit comments