apomelov
08/09/2018, 6:01 AMConfig
. There is also declare type Config = { ... }
. In kotlin code Config
becomes an external interface with plenty of optional vars. How should I create an instance of this interface? Just like this?
val cfg = object : Config {
override var width: dynamic
get() = 200
set(value) {}
override var height: dynamic
get() = 300
set(value) {}
...
}
It looks monstrous for me...Roman Artemev [JB]
08/09/2018, 11:39 AMoverride var width = 200
set(value) {}
override var height = 300
set(value) {}
Anyway it seems like you need a custom setter so it should be declared explicitlyapomelov
08/09/2018, 11:44 AMConfig(200, 300)
.apomelov
08/09/2018, 11:48 AMRoman Artemev [JB]
08/09/2018, 11:50 AMRoman Artemev [JB]
08/09/2018, 11:52 AM@JsName("Config")
external interface _Config
class Config(...): _Config {
...
}
Is this working for you?apomelov
08/09/2018, 11:58 AMapomelov
08/09/2018, 12:00 PMRoman Artemev [JB]
08/09/2018, 12:00 PMapomelov
08/09/2018, 12:02 PMbashor
08/09/2018, 1:28 PMval cfg = object : Config {
override var width = 200
override var height = 200
}
bashor
08/09/2018, 3:49 PMbashor
08/09/2018, 3:52 PMfun <T> newJsObject(): T = js("{}")
val x = newJsObject<FooBar>().apply {
width = 200
height = 100
}
bashor
08/09/2018, 4:08 PMIs ts2kt being developed right now?Yes, we going to continue working on it. Unfortunately, last few months it wasn’t getting enough attention.
ankushg
08/09/2018, 9:32 PMJson
and pass it into a constructor for a real Kotlin class?ankushg
08/09/2018, 9:33 PM