From bea41fd9f7b740123d3c46ef67eb298eb5dbb110 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 10 Oct 2016 17:38:27 -0500 Subject: [PATCH] Work around Microsoft/TypeScript#11375 This work is based on changes by @BurtHarris in #26. --- src/misc/Stubs.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/misc/Stubs.ts b/src/misc/Stubs.ts index ad29eadf..9b864e81 100644 --- a/src/misc/Stubs.ts +++ b/src/misc/Stubs.ts @@ -148,7 +148,11 @@ class IterableAdapter implements Iterable, IterableIterator { [Symbol.iterator]() { this._iterator = this.collection.iterator(); return this;} next(): IteratorResult { - if (!this._iterator.hasNext()) return { done: true, value: undefined }; - return {done: false, value: this._iterator.next()} + if (!this._iterator.hasNext()) { + // A bit of a hack needed here, tracking under https://github.com/Microsoft/TypeScript/issues/11375 + return { done: true, value: undefined } as any as IteratorResult; + } + + return { done: false, value: this._iterator.next() } } } \ No newline at end of file