In Kotlin/JS the qualifiedName is not available: <...
# multiplatform
p
In Kotlin/JS the qualifiedName is not available: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/qualified-name.html Does anyone know if this will be resolved soon or what are the limitations to this problem from a technical point? Anyone has a recommendation on how to work around this limitation? I want to convert class instances to a plain js object with following structure: {type: “fqdn of the actual instance”, payload: actual instance}. Without declaring a string manually, I currently see no way.
simpleName
is not enough because of duplicate class names in different packages or using sealed classes like this:
Copy code
// commonMain:
sealed class GetTagsAction {
    object Request : GetTagsAction()
    data class Response(val response: UserTagsResponse) : GetTagsAction()
    data class Error(val error: HttpException) : GetTagsAction()
}

// kotlinJs:
kotlinext.js.js {
    this.type = this::class.qualifiedName!!
    this.payload = action
}