diff --git a/src/index.ts b/src/index.ts index dd9f2de..cfbbf4b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,5 @@ function concatImpl(): Iterator -function concatImpl(...iterables: Array>): Iterator -function concatImpl(iterableA: Iterable): Iterator -function concatImpl(iterableA: Iterable, iterableB: Iterable): Iterator -function concatImpl(iterableA: Iterable, iterableB: Iterable, iterableC: Iterable): Iterator -function concatImpl(iterableA: Iterable, iterableB: Iterable, iterableC: Iterable, iterableD: Iterable): Iterator -function concatImpl(iterableA: Iterable, iterableB: Iterable, iterableC: Iterable, iterableD: Iterable, iterableE: Iterable): Iterator +function concatImpl[]>(...iterables: T): Iterator ? U : never, undefined, void>; function concatImpl(...iterables: Array>): Iterator function concatImpl(...iterables: Array): Iterator { const openMethods: Array<{ openMethod: () => Iterator, iterable: Iterable}> = []; @@ -21,8 +16,8 @@ function concatImpl(...iterables: Array): Iterator { return Iterator.from({ next() { while (!done) { - if (iterator != null && nextMethod != null) { - let iterResult = nextMethod.call(iterator); + if (iterator != null) { + let iterResult = nextMethod!.call(iterator); if (!iterResult.done) { return iterResult; } @@ -48,7 +43,7 @@ function concatImpl(...iterables: Array): Iterator { } done = true; } - return { done: true, value: void 0, }; + return { done: true, value: void 0 }; }, }); }