what can i do in this situation where i'm calling ...
# announcements
d
what can i do in this situation where i'm calling a native javascript function where the variadic arguments can be anything except a List?
Copy code
@JsName("nativeFoo")
external fun foo(vararg children: Any?) // each child can be one of null | Array<*> | String

val nums = listOf(1, 2, 3)
foo("hi", null, nums)                 // Runtime error since nums is a list
foo("hi", null, nums.toTypedArray())  // Works, but user shouldn't have to remember to do this
foo("hi", null, arrayOf(1, 2, 3))     // Works