Cannot use Select component with "onChange" property in Scala 2.13
Closed this issue · 4 comments
khanhdb commented
I couldn't do this :
_.events.onChange.map(_.detail.selectedOption.dataset.get("name").get)
inside a Select
component. This is how events.onChange
was implemented :
val onChange = new EventProp[dom.Event & HasDetail[HasSelectedOption]]("change")
then the type of onChange
in Scala 2 is infered as Nothing
, there's no more access to .detail.selectedOption
Is that a bug ? Is there any workaround for this ?
Thank you
sherpal commented
Ouch, that's bad. I though that Scala 2.13 was able to understand &
😭
I'll correct that. In the meantime, you can always do
_.events.onChange.map(_.asInstanceOf[dom.Event with HasDetail[HasSelectedOption]]).map(_.detail.selectedOption.dataset.get("name").get)
It's not ideal, of course, but it will at least work.
I will change all the &
back to with
for now then...
khanhdb commented
Thank you so much !