I know that implicit conversions are available for js.FunctionN <–> scala.FunctionN. However, if I work with libraries in dynamic fashion (without typed facade), they won't help me, because the compiler obviously doesn't know that I need a conversion. For example, if a JS code expects a JS Array with a string and a function as an input -- something like
['Hello world', function ($x, $y) {
console.log($x + $y)
}],
, I can't create it in Scala like this:
val a: js.Array[Any] = js.Array(
"Hello world",
(x: Int, y: Int) => {console.log(x + y)}
)
)
Because Scala function will not be converted to JS function. Does there exist some explicit conversion method for that, similar to toJSArray for mutable Seq? I've checked that asInstanceOf[js.Function] doesn't work.