Type mistmach in Scala.js tutorial for ScalablyTyped

25 Views Asked by At

I'm trying to run Scala.js tutorial of Integrate JavaScript libraries with ScalablyTyped, but I'm getting an error that I don't understand.

Here is the code

  // Bridge the FRP world of dataSignal to the imperative world of the `chart.data`
  dataSignal --> { data =>
    for (chart <- optChart) {
      val fullPrices = data.map(_.fullPrice).toJSArray
      chart.data.labels = data.map(_.label).toJSArray
      chart.data.datasets.get(0).data = data.map(_.price).toJSArray
      chart.data.datasets.get(1).data = data.map(_.fullPrice).toJSArray
      chart.update()
    }
  }

And this is the error

[error]  found   : scala.scalajs.js.Array[Double]
[error]  required: scala.scalajs.js.UndefOr[scala.scalajs.js.Array[scala.scalajs.js.UndefOr[scala.scalajs.js.Array[Double] | typings.chartJs.mod.ChartPoint | Double | Null]]]
[error]     (which expands to)  scala.scalajs.js.Array[scala.scalajs.js.Array[Double] | typings.chartJs.mod.ChartPoint | Double | Null | Unit] | Unit
[error]           chart.data.datasets.get(1).data = fullPrices
[error]                                             ^
0

There are 0 best solutions below