re: Exhaustive Type Checking with TypeScript! VIEW POST


Exhaustiveness checking seems like the 'default' behavior for the above switch statements.

Great article though.


Yes, but it’s more explicit. Even in C# (which doesn’t have exhaustiveness checking like TypeScript), the best practice is to throw an error in the default case that says “unexpected case”. The benefit of TS is that it can catch those unexpected cases at compile time too! :)


Agreed. Thanks a lot.

Code of Conduct Report abuse