|
|
|
|
|
by bad_user
684 days ago
|
|
Those are untagged union types and are less useful than you think. For one, they don't work for generic code where you want to discriminate. I.e., if you have a generic A or B type, you can't pattern match on it. And it's hard to add restrictions to the generic types such that it would work. Such types sort of work in TypeScript, but TypeScript also has structural typing, meaning that it's designed for it. |
|