Closed spinillos closed 1 year ago
We explored doing this with the original approach to cuetsy - basically, having enums in CUE be structs - as that seemed most obviously comparable to the way that enums feel to folks writing TypeScript.
But it doesn't work out. The enum field names that we choose to generate in cuetsy do not exist in CUE; CUE (correctly) interprets Enum.Value1
as a reference, and that reference does not exist. Nor can it, because Enum
is string-kinded, not struct-kinded.
When we reference an enum value,
cuetsy
was setting only the enum class missing the value.For example:
was generating:
and now it generates: