4 ms·
If you don't annotate the return value you open yourself up to another class of mistakes because the compiler can't check that each branch returns the correct t
by akiselev 6y ago
If you don't annotate the return value you open yourself up to another class of mistakes because the compiler can't check that each branch returns the correct type, especially if type inference decides the function returns `any` which swallows `undefined` in type hints, while also losing the self-documenting aspect without an IDE.