mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Add regression test
This commit is contained in:
parent
ed338013e0
commit
7b1ca047d5
27
tests/cases/compiler/controlFlowWithIncompleteTypes.ts
Normal file
27
tests/cases/compiler/controlFlowWithIncompleteTypes.ts
Normal file
@ -0,0 +1,27 @@
|
||||
// Repro from #11000
|
||||
|
||||
declare var cond: boolean;
|
||||
|
||||
function foo1() {
|
||||
let x: string | number | boolean = 0;
|
||||
while (cond) {
|
||||
if (typeof x === "string") {
|
||||
x = x.slice();
|
||||
}
|
||||
else {
|
||||
x = "abc";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function foo2() {
|
||||
let x: string | number | boolean = 0;
|
||||
while (cond) {
|
||||
if (typeof x === "number") {
|
||||
x = "abc";
|
||||
}
|
||||
else {
|
||||
x = x.slice();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user