Hi Matthew,

I am concerned with some edge cases. What if a function both returns and
throws at the same time? For example:

function a():noreturn {
    return throw new Exception('Boom!');
}

or

function a():noreturn {
try {
throw new Exception('Boom!');
} finally {
        return;
    }
}

Also, the message "TypeError: a(): Nothing was expected to be returned" is
inaccurate. It should say that the function should terminate instead of
returning. It's also not a TypeError if no value is expected. At the moment
it sounds like we need to make the function somehow return nothing.

If we are to bikeshed about the name then we might also consider other
possibilities: None, Nothing, Returnless

Regards,
Kamil

Reply via email to