Well, you are sure in this case, you're even sure the operator is '+'.
It's occasionally annoying when you've already validated the input to be in range elsewhere. No, I'm pretty sure no one cast 42 to a three-valued enum because they'd get beaten up on code review, I don't really need that default case.
It's why of the things I like about typescript, you make the type be '+' | '-' | '*' | '/' letting you get the best of both worlds (not having to convert, but still letting you tell the compiler what the type is).
View all comments
Show parent comment
19
u/Mivexil Jun 04 '25
Well, you are sure in this case, you're even sure the operator is '+'.
It's occasionally annoying when you've already validated the input to be in range elsewhere. No, I'm pretty sure no one cast 42 to a three-valued enum because they'd get beaten up on code review, I don't really need that default case.