Any TypeScript experts over here?
Putting aside JS and existing libraries compatibility, why would use something like
function f(arg : Foo | Bar | Baz) {...}
in a new pure TS code?
Why would you trick yourself into handling all that with type guards and stuff, if you can just write three different functions?
Again, assuming we're not dealing with any legacy/JS code.
#TypeScript #TS #JavaScript #JS
P.S. Not trolling, just really curious.