Closed
Description
TypeScript Version:
1.8
Code
// compiles
function foo(): number {
throw new Error('Everything is gonna be alright!');
}
// does not compile
const bar: () => number = () => {
throw new Error('WHYUNO?!?');
}
Expected behavior:
Functions foo
and bar
type-check, because an exception is thrown in their body which effectively means "bottom", so any return type should be permitted.
Actual behavior:
While function foo
type-checks, bar
does not.