Pascal doesn't have union types, it has variant records and/or multi-declaration, which really aren't the same thing.
And I should have been more clear, I don't have problems with the overall concept -- though they SHOULD be separate function definitions --, I have problems with this dipshit implementation that is NOT part of JavaScript... aka using the single | to create them, making it pointlessly cryptic and confusing since that operator already has a purpose.
Aka (from their docs)
function printId(id: number | string) {
Though it makes me think that under the hood their type definitions are in fact binary properties.
And it's not part of JavaScript because being loosely typed, JS doesn't need it.
Anyhow it's almost comical how the entire point of typescript is supposed to be strict typecasting, then they give you a mechanism to violate that. Don't you see how that's kind-of derp?
Again though, I'm an Ada guy, I'm used to strict typecasting being ... well... stricter than the nun with a ruler who taught me to program, rapping me across the knuckles with a yardstick screaming "INDENT".. ***THWAP*** DE-INDENT! ***THWAP*** INDENT!!!