Hi everyone, I'm getting the following error when ...
# serialization
f
Hi everyone, I'm getting the following error when parsing sealed classes in Kotlin/JS:
Copy code
type is not registered for polymorphic serialization in the scope of class
This is my code:
Copy code
@Serializable
sealed class TestClass {

    @Serializable
    @SerialName("TEST_1")
    data class TestClass1(
        val value1: String,
        val value2: Int
    ) : TestClass()

    @Serializable
    @SerialName("TEST_2")
    data class TestClass2(
        val value1: String
    ) : TestClass()

}
I found this link where the issue is discussed: https://github.com/Kotlin/kotlinx.serialization/issues/457 and seems like a fix is ready (but not yet released). I was wondering if there is a workaround that allows us to make it work until the fix is released? (I know that I can do this using a Serializer but not sure how to build it in a way that I can remove it once the fix for this is released and nothing will break).
t
Does it work without ‘nesting’?
f
Hi @turansky, I tried it without nesting and the issue remained.