You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DOMMatrix and DOMMatrixReadonly constructors are typed as accepting only number[] but they also accept TypedArrays in all browsers.
The following code works in all browsers:
Sample Code
newDOMMatrix(newFloat32Array(16))
Documentation Link
The MDN documentation doesn't really mention this detail, and the spec mentions a "sequence" which to me isn't very specific. Isn't a TypedArray a "sequence of numbers"?
Perhaps the type should probably be ArrayLike<number>.
The text was updated successfully, but these errors were encountered:
Besides this, DOMMatrix has toFloat32Array and toFloat64Array methods, and not a toArray method. Makes sense to be able to pass typed arrays if it can also return typed arrays. I've also opened an issue with the spec to add toArray.
The MDN documentation doesn't really mention this detail, and the spec mentions a "sequence" which to me isn't very specific. Isn't a TypedArray a "sequence of numbers"?
⚙ Compilation target
n/a
⚙ Library
lib.dom
Missing / Incorrect Definition
DOMMatrix and DOMMatrixReadonly constructors are typed as accepting only
number[]
but they also acceptTypedArray
s in all browsers.The following code works in all browsers:
Sample Code
Documentation Link
The MDN documentation doesn't really mention this detail, and the spec mentions a "sequence" which to me isn't very specific. Isn't a TypedArray a "sequence of numbers"?
Perhaps the type should probably be
ArrayLike<number>
.The text was updated successfully, but these errors were encountered: