Is there any meaningful difference between: ```//...
# javascript
q
Is there any meaningful difference between:
Copy code
// kt
external interface Dress {
  val color: Int
} 
val dress: Dress = jso { color = ... }
and
Copy code
// ts

const dress: Dress = { color: ... }
I'm noticing that the first is failing the serialization with
fast-json-stringify
, while the second is passing it. If I stringify and parse the result with
JSON.parse(JSON.stringify(dress))
then it passes the serialization successfully 🤔 Wondering if there's something in the instance created by
jso
that is preventing the serialization
t
No difference expected
Possible root causes: • Invalid schema • Non-external interface in
jso
created (looks like this)
q
I managed to fix it and ultimately turned the external interface into a data class. The fact that my external interface was implementing another external interface was preventing it from being serialized correctly on the JS side
Copy code
external interface Base

external interface Derived: Base {
  var property: String
}

val obj = jso { property = "" } // this fails to be serialized with fast-json-stringify

data class Derived2(val property: String) : Base
val obj2 = Derived2("") // this also fails to be serialized

data class Derived3(val property: String)
val obj3 = Derived3("") // this succeeds