Sam Garfinkel
09/09/2019, 3:21 PMFoo({...})
)?Svyatoslav Kuzmich [JB]
09/09/2019, 3:28 PMFoo
that takes an object {...}
of a particular shape as a constructor parameter. Did I understand you correctly?Sam Garfinkel
09/09/2019, 3:29 PMSam Garfinkel
09/09/2019, 3:29 PMSvyatoslav Kuzmich [JB]
09/09/2019, 3:32 PMexternal interface FooParameter {
// ...
}
external class Foo(p: FooParameter) {
// ...
}
Sam Garfinkel
09/09/2019, 3:32 PMSam Garfinkel
09/09/2019, 3:35 PM{}
with optional parameters? Suppose new Foo({})
accepts an object {A: 'foo', B: 'bar'}
, where A or B may be undefined. In Kotlin we'd use default parameters on the constructor, what's the analogue for the wrapper?Svyatoslav Kuzmich [JB]
09/09/2019, 3:38 PMdefinedExternally
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/defined-externally.htmlSam Garfinkel
09/09/2019, 3:46 PMSvyatoslav Kuzmich [JB]
09/09/2019, 3:49 PMexternal interface I {
var A: String? get() = definedExternally; set(value) = definedExternally
var B: String? get() = definedExternally; set(value) = definedExternally
}
Sam Garfinkel
09/09/2019, 3:56 PMI
each time you want to pass it to Foo
?Svyatoslav Kuzmich [JB]
09/09/2019, 4:43 PMI
. But you can also wrap the whole thing with a regular function that uses default parameters.turansky
09/10/2019, 8:10 AMFoo
after creation?turansky
09/10/2019, 8:10 AM