TypeScript infers () => never for foo if it's the result of a function expression which doesn't return:
const foo = function () {
throw new Error();
}
But void if foo is a function statement:
function foo() {
throw new Error();
}
I don't get it. Would be great to have an explanation.