prashan
05/15/2024, 9:13 PMjw
05/15/2024, 9:19 PMjw
05/15/2024, 9:19 PMprashan
05/15/2024, 9:22 PMprashan
05/15/2024, 9:37 PMprashan
05/16/2024, 3:10 PM// Kotlin
data class TestDataClass(val test: String)
// Generated JS
protoOf(TestDataClass).copy = function (test, $super) {
test = test === VOID ? this.test : test;
return this.i(test);
};
and VOID
here is defined as js("void 0")
which evaluates to undefined
(https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/js/runtime/void.kt)
so we can at least somewhat get the desired copy behavior by passing in undefined
to the fields you want to keep the same.