is it documented somewhere how a kotlin class look...
# javascript
c
is it documented somewhere how a kotlin class looks like in js? for example if i have a `data class K(val a:String, val b:String)`and i instantiate it as
K("first", "second")
, then cast it to dynamic and pass it to a javascript method, does it look like this: `{a: "first", b:"second"}`(possibly with more fields) ?
🚫 2
t
If you need plain object like in example - use #serialization
If you need public contract for
data class
(performance optimization for example) you can use
external interface
c
i have kotlin data classes that i serialize to json on the server and then i want to use it in a react app that is mostly typescript. so if i deserialize it to a kotlin object i have to serialize it again if i want to use it in typescript
so i was wondering if i instead just convert the json to typescript object.
after some experimenting it seems your suggestion of a data class that implements an external interface is exactly what i needed. thanks!
🙂 1