re: Type Safe Message Dispatch in TypeScript VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION
 

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