amnaredo / test

0 stars 0 forks source link

Cannot create Js.Arr from a Seq[Js.Value] #124

Open amnaredo opened 3 years ago

amnaredo commented 3 years ago

To reproduce:

val arr = Js.Arr(Seq(Js.Str("a"), Js.Str("b")))

Expected: an Arr is created Actual: Compiler error:

[error]  found   : Seq[upickle.Js.Str]
[error]  required: upickle.Js.Value
[error]     val arr = Js.Arr(Seq(Js.Str("a"), Js.Str("b")))
[error]                         ^

This happens when using Scala.js and compiling in the set console with compile

Js.Arr has a varargs apply and Scala should auto-convert varargs to Seq, but it incorrectly uses the other apply method.

ID: 84 Original Author: rabejens

amnaredo commented 3 years ago

Try Js.Arr(Seq(Js.Str("a"), Js.Str("b")):_*)?

Original Author: lihaoyi