Re:TypeScript’s quirks: How inconsistencies make the languag...
by twotwotwo on Saturday February 01, 2020 @12:05AM
(#22208809)
> Most other languages I know of only have a single type for a variable (and if you want to pattern match you must give each case a new variable name).
FWIW, Go also changes the variable's type in type-switch cases: https://tour.golang.org/methods/16