Closed
Description
TypeScript Version: 2.5.2
Code
function foo(): never {
throw new Error()
}
function bar(): number {
if (Math.random() > 0.5)
return 1;
foo();
// compiler should realise we can't get here.
}
Expected behavior:
Compiles without warnings when compiled with --noImplicitReturns
Actual behavior:
error TS7030: Not all code paths return a value.