Grantas33
04/25/2020, 5:28 PMit.json().await().unsafeCast<CommonDateTime>()
CommonDateTime:
expect class CommonDateTime(millis: Long) {
fun getYear(): Int
}
However, calling getYear()
function on a casted instance yields an error: TypeError: is not a function
(since unsafeCast
just uses dynamic JS values). Is there an alternative to unsafeCast
that would actually create the objects from JSON so that I could call its instance methods?turansky
04/25/2020, 6:24 PMkotlinx.serialization
to receive Kotlin/JS class instance from JSON or JS object
https://github.com/Kotlin/kotlinx.serializationIlya Goncharov [JB]
04/29/2020, 8:20 AM