I know you and I already discussed this, but for the benefit of your readers: in TypeScript you can still get the benefit of exhaustiveness checking even with if statements. I describe how to do that here: dev.to/cubiclebuddha/is-defensive-...
Thank you for this article though because even though I’m not a fan of switch statements (for purely subjective reasons + the break issue that you mentioned), it’s really nice to hear from the opposite perspective. Also, you made a great point about hiding complexity with your expr example. Nice work. :)
I know you and I already discussed this, but for the benefit of your readers: in TypeScript you can still get the benefit of exhaustiveness checking even with
if
statements. I describe how to do that here: dev.to/cubiclebuddha/is-defensive-...Thank you for this article though because even though I’m not a fan of switch statements (for purely subjective reasons + the break issue that you mentioned), it’s really nice to hear from the opposite perspective. Also, you made a great point about hiding complexity with your
expr
example. Nice work. :)Defensive programming is a must. It's great if you can ensure coverage even with if-else in TypeScript.