johnfn
02/17/2020, 10:07 PMobject { val x = 1 } and then i want to make a list of them, how would i write it? ideally, something that i could put in ???
class Foo {
private val myList = mutableListOf<???>()
private fun addItem(x: Int) =
myList.add(
object { val x = x }
)
}Shawn
02/17/2020, 11:01 PMAnyShawn
02/17/2020, 11:02 PMAny like everything does by defaultShawn
02/17/2020, 11:02 PMx valShawn
02/17/2020, 11:04 PMShawn
02/17/2020, 11:05 PMMapShawn
02/17/2020, 11:07 PMChenn
02/18/2020, 8:25 AMval obj = js("{}")
obj["type"] = type
This is how I put a key - value pair in an anonymous object in kotlin. Maybe it helps.Chenn
02/18/2020, 8:29 AMval obj: dynamic = object{}
reducers.forEach { obj[it.key] = it.value}
This practically generates the same code..Shawn
02/18/2020, 3:59 PMjs() isn’t a stdlib function and dynamic isn’t a standard type on JVM, and presumably elsewhereChenn
02/18/2020, 4:01 PM