Hildebrandt Tobias
11/27/2024, 12:43 PMjso
?
So lets say I have
external interface DemoProps: Props {
var first: String
var second: Int
}
In many JS examples they just do something along the lines of
val jso1 = jso<DemoProps> { first = "hello" }
val jso2 = jso<DemoProps> { second = 42 }
val merged = jso1 + jso2
What works is
val merged = jso1.apply { second = jso2.second }
but is there a way without adressing every field again?
Edit: This works, but is a bit scetchy:
val merged = js("{...jso1, ...jso2}") as DemoProps
turansky
11/27/2024, 12:51 PMval merged = Object.assign(jso(), jso1, jso2)
Hildebrandt Tobias
11/27/2024, 12:52 PMspread
worked, but that looks better.
Thanks.Hildebrandt Tobias
11/27/2024, 12:53 PMObject.assign(jso<AppDialogProps>(), preset, additional)
turansky
11/27/2024, 12:56 PMjs
calls aren't recommended.
For now all known problems can be solved without it (via Kotlin Wrappers).Hildebrandt Tobias
11/27/2024, 12:59 PMObject.assign
wrapped this closely. 😄