Confusing type of ImageData.data
OndrejSpanel opened this issue · 3 comments
The ImageData.data is defined and documented as follows:
scala-js-dom/dom/src/main/scala/org/scalajs/dom/ImageData.scala
Lines 23 to 26 in 7d0508c
I am confused: is the type Uint8ClampedArray
, or js.Array[Int]
? Or are those types interchangeable somehow? If they are, perhaps the documentation could clarify how.
Hmm. I don't think those are interchangeable. Seems like a bug to me.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray
I guess the interface of both JS types is similar enough, they both contain length
and bracket access, therefore one can perform some basic operations on TypedArray
thinking it is a normal array.