Open amnaredo opened 3 years ago
Seems like a type inference bug. Temporary workaround:
@ ujson.Js.Obj("a" -> 1)
cmd0.sc:1: overloaded method value apply with alternatives:
(value: scala.collection.mutable.LinkedHashMap[String,ujson.Js.Value])ujson.Js.Obj <and>
(items: (String, ujson.Js.Value)*)ujson.Js.Obj
cannot be applied to ((String, Int))
val res0 = ujson.Js.Obj("a" -> 1)
^
Compilation Failed
@ ujson.Js.Obj("a" -> ujson.Js.Num(1))
res0: ujson.Js.Obj = Obj(Map("a" -> Num(1.0)))
Original Author: lihaoyi
This change seems to break the following use-case, for example used in the (older?) autowire examples serializing to Js.Value:
data = ujson.write(Js.Obj(req.args.toSeq:_*)))
This can be worked around with
data = ujson.write(Js.Obj(req.args.head, req.args.tail.toSeq:_*))
but needs extra care if req.args
is empty.
Not sure what is the best solution, just a FYI.
Original Author: Dennis4b
I get a compile error here:
Error:
The same thing happens with
Js.Obj("a" -> "b")
. However,JsObj("a" ->1, "b" -> 2)
works.ID: 230 Original Author: winitzki