re: Type Safe Message Dispatch in TypeScript VIEW POST

re: Thank you for a great post! The issue I want to bring up is not specifically regarding your atricle but rather a general Typescript issue. And I t...

Thanks for the comment. TypeScript is not OCaml or ML derivative language so it doesn't have pattern matching but it has exhaustiveness checking so the compiler still helps with switch statements.

Re: combining the branches. The compiler isn't smart enough to verify the combined case so they have to be separate for exhaustiveness checking and type inference to work.

code of conduct - report abuse