import { IterableX } from './iterablex' ; class DeferIterable < T > extends IterableX < T > { private _fn : ( ) => Iterable < T > ; constructor ( fn ) { super ( ) ; this . _fn = fn ; } * [ Symbol . iterator ] ( ) { for ( const item of this . _fn ( ) ) { yield item ; } } } template TSource param { ( ( ) => Iterable < TSource > ) } factory returns { AsyncIterableX < TSource > } export function defer < TSource > ( factory ) { return new DeferIterable < TSource > ( factory ) ; }