1/ I love #TypeScript’s discriminated unions: https://exploringjs.com/tackling-ts/ch_special-values.html#discriminated-unions
Alas, I often end up switching to classes:
A. The discriminant is not very sticky:
– There is no refactoring for renaming it.
– TS cannot infer the type of an object via a discriminant (only narrow it). In contrast to: new MyClass()
B. Classes provide locations for initialization code and operations. I could put each DU in its own module but that is often too fine-grained for my taste. Future: submodules?