Skip to content

Commit 64a6e6c

Browse files
authored
Merge pull request #41507 from microsoft/fix32890
Fix definition of ts.Iterator
2 parents 573768a + 54e54f4 commit 64a6e6c

File tree

7 files changed

+13
-11
lines changed

7 files changed

+13
-11
lines changed

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/compiler/corePublic.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace ts {
8888

8989
/** ES6 Iterator type. */
9090
export interface Iterator<T> {
91-
next(): { value: T, done?: false } | { value: never, done: true };
91+
next(): { value: T, done?: false } | { value: void, done: true };
9292
}
9393

9494
/** Array that is only intended to be pushed to, never read. */

src/compiler/sys.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,9 @@ namespace ts {
621621
const invokeMap = new Map<Path, string[]>();
622622

623623
while (!timerToUpdateChildWatches && cacheToUpdateChildWatches.size) {
624-
const { value: [dirPath, { dirName, options, fileNames }], done } = cacheToUpdateChildWatches.entries().next();
625-
Debug.assert(!done);
624+
const result = cacheToUpdateChildWatches.entries().next();
625+
Debug.assert(!result.done);
626+
const { value: [dirPath, { dirName, options, fileNames }] } = result;
626627
cacheToUpdateChildWatches.delete(dirPath);
627628
// Because the child refresh is fresh, we would need to invalidate whole root directory being watched
628629
// to ensure that all the changes are reflected at this time

src/shims/collectionShims.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace ts {
99

1010
type IteratorResultShim<T> =
1111
| { value: T, done?: false }
12-
| { value: never, done: true };
12+
| { value: void, done: true };
1313

1414
interface IteratorShim<T> {
1515
next(): IteratorResultShim<T>;

src/testRunner/unittests/tsbuild/helpers.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ interface Symbol {
189189
export function generateSourceMapBaselineFiles(sys: System & { writtenFiles: ReadonlyCollection<string>; }) {
190190
const mapFileNames = mapDefinedIterator(sys.writtenFiles.keys(), f => f.endsWith(".map") ? f : undefined);
191191
while (true) {
192-
const { value: mapFile, done } = mapFileNames.next();
193-
if (done) break;
192+
const result = mapFileNames.next();
193+
if (result.done) break;
194+
const mapFile = result.value;
194195
const text = Harness.SourceMapRecorder.getSourceMapRecordWithSystem(sys, mapFile);
195196
sys.writeFile(`${mapFile}.baseline.txt`, text);
196197
}

tests/baselines/reference/api/tsserverlibrary.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ declare namespace ts {
8181
value: T;
8282
done?: false;
8383
} | {
84-
value: never;
84+
value: void;
8585
done: true;
8686
};
8787
}

tests/baselines/reference/api/typescript.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ declare namespace ts {
8181
value: T;
8282
done?: false;
8383
} | {
84-
value: never;
84+
value: void;
8585
done: true;
8686
};
8787
}

0 commit comments

Comments
 (0)