Skip to content

lib.dom: DOMatrix constructor accepts TypedArrays, not only Arrays. #60862

Open
@trusktr

Description

@trusktr

⚙ Compilation target

n/a

⚙ Library

lib.dom

Missing / Incorrect Definition

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

new DOMMatrix(new Float32Array(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>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions