> There is no other programming language that has union types as powerful as TypeScript
How about Swift and OCaml? ReasonML comes to mind too. Haven't tried actively comparing any of them though.
How about Swift and OCaml? ReasonML comes to mind too. Haven't tried actively comparing any of them though.
type union = Bool of bool | Char of char | Nothing
let (x, y, z) = (Nothing, Bool true, Char 'x') let a = random() ? 'a' : 1
TypeScript infers type string | numberI merely know from experience that they have a pretty good type system, but not much more. So I asked :-)
Answers have been enlightening