import { AsyncIterableX } from './asynciterablex' ; import { OperatorAsyncFunction , UnaryFunction } from '../interfaces' ; import { Transform , TransformCallback , TransformOptions } from 'stream' ; export interface AsyncIterableTransform < T > extends AsyncIterableX < T > , Transform { pipe < R > ( ... operations ) : R ; pipe < R > ( ... operations ) : AsyncIterableX < R > ; pipe < R extends NodeJS . WritableStream > ( writable , options ? ) : R ; [ Symbol . asyncIterator ] ( ) : AsyncIterableIterator < T > ; } const asyncIterableMixin = Symbol ( 'asyncIterableMixin' ) ; export class AsyncIterableTransform < T > extends Transform { private static [ asyncIterableMixin ] = false ; constructor ( options ? ) { super ( options ) ; if ( ! AsyncIterableTransform [ asyncIterableMixin ] ) { AsyncIterableTransform [ asyncIterableMixin ] = true ; Object . defineProperties ( AsyncIterableTransform . prototype , Object . getOwnPropertyDescriptors ( AsyncIterableX . prototype ) ) ; } } nocollapse _flush ( callback ) { callback ( ) ; } nocollapse _transform ( chunk , _encoding , callback ) { callback ( null , chunk ) ; } } export function asAsyncIterable < T > ( options = { } ) { return new AsyncIterableTransform < T > ( options ) ; }