ankur2037
09/14/2023, 5:27 AMdata class
inheriting from a sealed class
. When I override a field in the data class and then console.log()
the instance in JS, the overridden field appears to have an obfuscated name.
@OptIn(ExperimentalJsExport::class)
@JsExport
data class Demo(override val id: String) : DemoParent()
@JsExport
sealed class DemoParent() {
abstract val id: String
}
fun main() {
val demo = Demo("myId")
console.log(demo)
}
Console shows:
Demo {q5q_1: 'myId'}
q5q_1: "myId"
id: "myId"
[[Prototype]]: DemoParent
Notice the id
property also has this q5q_1
version? 🤔
I'm using dev.petuska.npm
for npm publishing.
Has anyone come across this? Is it a Kotlin/JS issue? Or maybe something with the dev.petuska.npm
plugin?Artem Kobzar
09/14/2023, 5:42 AMid
is val
) property on prototype with a stable name.
Seems like Chrome/Node also show this property as an objects' fieldankur2037
09/14/2023, 6:49 AMArtem Kobzar
09/14/2023, 7:52 AMArtem Kobzar
09/14/2023, 7:53 AMankur2037
09/14/2023, 8:01 AMArtem Kobzar
09/14/2023, 9:24 AMankur2037
09/14/2023, 5:41 PM