在 Elm 中,没有本地方法来编码/解码自定义类型。这使得向 JS 发送和接收自定义类型的值变得困难。我有一段时间很困惑,想知道如何处理像下面这样的简单自定义类型?
type MyCustomType = A | B | C
json custom-type elm
custom-type ×1
elm ×1
json ×1