Open crdev opened 10 years ago
i think the real bug here is just that 1 + undefined
should be a type error. the compiler is pretty good about figuring out when a function doesn't return anything
Yeah, sounds about right, but the compiler seems to skip this check...
1 - foo() produces a type error. Clearly it is being to conservation about warning about string concats.
Here's the case:
In this case, the
foo()
function has no@return
annotation, since it does not return anything. However, it used to@return {number}
, andbar()
contains code relying on this. Now thatfoo()
has been modified to not return anything, the compiler considers its return type as?
(unchecked), and hence does not detect the error inbar()
.