Hey everyone 👋,
I've run into a quirky behavior with Kotlin/JS. Curious to know if anyone has seen this before or if it's just the norm?
I've got a
data 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?