We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 50f3910 commit 815af7dCopy full SHA for 815af7d
1 file changed
src/compiler/checker.ts
@@ -11066,8 +11066,14 @@ namespace ts {
11066
if (!links.switchTypes) {
11067
// If all case clauses specify expressions that have unit types, we return an array
11068
// of those unit types. Otherwise we return an empty array.
11069
- const types = map(switchStatement.caseBlock.clauses, getTypeOfSwitchClause);
11070
- links.switchTypes = !contains(types, undefined) ? types : emptyArray;
+ links.switchTypes = [];
+ for (const clause of switchStatement.caseBlock.clauses) {
11071
+ const type = getTypeOfSwitchClause(clause);
11072
+ if (type === undefined) {
11073
+ return links.switchTypes = emptyArray;
11074
+ }
11075
+ links.switchTypes.push(type);
11076
11077
}
11078
return links.switchTypes;
11079
0 commit comments