Skip to content

Commit c590156

Browse files
committed
Add regression test
1 parent a15436c commit c590156

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/cases/conformance/controlFlow/exhaustiveSwitchStatements1.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,19 @@ function foo() {
223223
}
224224
}
225225
}
226+
227+
// Repro from #35070
228+
229+
type O = {
230+
a: number,
231+
b: number
232+
};
233+
type K = keyof O | 'c';
234+
function ff(o: O, k: K) {
235+
switch(k) {
236+
case 'c':
237+
k = 'a';
238+
}
239+
k === 'c'; // Error
240+
return o[k];
241+
}

0 commit comments

Comments
 (0)