7 ms·
Is this something typescript could fix? I've written a fair few union types with discriminants that work in the same way as rust enums. The trick though is to
by gwillz 7y ago
Is this something typescript could fix? I've written a fair few union types with discriminants that work in the same way as rust enums.
The trick though is to declare the redundant fields as undefined for every overlap case.
- _bxg1 7y agoPossibly. I've had trouble getting TypeScript to discriminate object unions in the past without manually writing type guards, which are cumbersome. This is one of the few things Flow is actually better at.