darkfo icon indicating copy to clipboard operation
darkfo copied to clipboard

Make use of typed unions, especially in Worldmap/Encounters

Open darkf opened this issue 7 years ago • 0 comments

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).

darkf avatar Jan 30 '17 08:01 darkf