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.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.