What would be the most straightforward way of implementing Swift-style enums with associated values in Typescript? Is it possible?
Within enums with associated values, I'm looking for the specific case of indirect enum
with associated values that can work with ASTs — see example below:
indirect enum Node {
case op(Node, Node)
case value(Double)
}
I found an answer to a related question but it's about Javascript support rather than Typescript support. I don't think this is a duplicate of that question; there may be some solutions that work in TypeScript but not in JavaScript.