Question: how will Kotlin handle the `variant` WIT...
# webassembly
e
Question: how will Kotlin handle the
variant
WIT type?
a
@Svyatoslav Kuzmich [JB] ^^
s
Current approach is to use sealed interface/class for the variant. Data classes and data objects are used for cases:
Copy code
variant color {
  rgb(rgb),
  hex(string),
  red
}
Copy code
sealed interface Color {
    data class Rgb(val value: Rgb) : Color
    data class Hex(val value: String) : Color
    data object Red : Color
}
e
Makes perfect sense, thanks