<@U0KGK0BUN> commented on <@U0B8FC23U>’s file <htt...
# announcements
u
@konsoletyper commented on @derkork’s file https://kotlinlang.slack.com/files/U0B8FC23U/F7HF7T96F/-.js: Or you can declare additional external interface for options, to make it more type-safe, i.e:
Copy code
external interface VehicleOptions {
    var address: String?
}

inline fun <T> opts(initFun: T.() -> Unit): T {
    val result: T = js("new Object()")
    result.initFun()
    return result
}

@JsModule("vehicles")
external class Vehicle(options: VehicleOptions) {
    
}

fun foo() {
    val v = Vehicle(opts {
        address = "123"
    })
}