function fail(): never {
throw new Error('oops');
}
function test1() {
let str: string;
fail();
str = 'helloworld'; // No error. Should error with unreachable code.
}
function test2() {
let str: string;
if (Math.random() > 0.5) {
str = 'helloworld';
}
else {
fail();
}
let str2 = str + ''; // Error: str is used before being assigned. But should not error.
}