darkfo
darkfo copied to clipboard
Make use of typed unions, especially in Worldmap/Encounters
A good example is https://hackernoon.com/tagged-unions-react-and-redux-55e262e4d0ea where we can use typed unions like ADTs in other languages, e.g.:
type Foo = {tag: 'A', x: T}
| {tag: 'B', y: U}
and then discriminate based on tag
(which will be type narrowed by conditionals).