It says that if you never specify as a return type, the function return statement should not be reachable. For example, a function will always cause an error, or somewhere an infinite loop.
It is easy to visualize this if we rewrite the example as follows:
function infiniteLoop(): never {
while (true) {
}
return 'this will never execute';
}
source
share