One more for the day. Youtrack: <https://youtrack...
# javascript
a
One more for the day. Youtrack: https://youtrack.jetbrains.com/issue/KT-45727 Prelude Normally we'd like to have interfaces or abstract classes as our public API, and have underlying implementations private/internal to the module. Problem With kotlin multiplatform and kotlin js, this is still a huge challenge because despite using 
@JsExport
, properties of interfaces/abstract classes, are still mangled. It should be known that methods are not mangled at all Reproducer Reproducer can be found at ManglingImplementationTest
Elaboration Consider the following block of code kt
Copy code
@JsExport
interface State<out T> {
    val value: T
}

@JsExport
interface MutableState<T> : State<T> {
    override var value: T
}

class MutableStateImpl<T>(override var value: T) : MutableState<T>
would cause this test to fail kt
Copy code
val state: State<Int> = MutableStateImpl(0)
window.asDynamic().state = state
assertEquals(0, window.asDynamic().state.value) // expected: 0, actual: undefined
Expected Behaviour This test should pass since 
State
 was marked with 
@JsExport
, therefore, 
MutableStateImpl
 should respect, State's export as it implements it kt
Copy code
val state: State<Int> = MutableStateImpl(0)
window.asDynamic().state = state
assertEquals(0, window.asDynamic().state.value) // expected: 0, actual: undefined
Please upvote these tickets as well, show them some love
👍 1