If I understand the problem correctly, the issue with the "else" branch.
Sure, if the number is finite then it's obviously not undefined, but if it's not finite, what is the type? What type should TypeScript use in the else branch?
[TRIPLE QUOTE].
[See in the playground.]([URL]
But I agree it's stupid :(, hopefully will be fixed soon by #15048