diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index f3b5e3c02..42523d8a9 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -12013,7 +12013,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -12205,7 +12205,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/serviceworker.generated.d.ts b/baselines/serviceworker.generated.d.ts index fd87652cd..1f2772d4b 100644 --- a/baselines/serviceworker.generated.d.ts +++ b/baselines/serviceworker.generated.d.ts @@ -3057,7 +3057,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3242,7 +3242,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/sharedworker.generated.d.ts b/baselines/sharedworker.generated.d.ts index 7aa724ad6..c184e7f08 100644 --- a/baselines/sharedworker.generated.d.ts +++ b/baselines/sharedworker.generated.d.ts @@ -2838,7 +2838,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3023,7 +3023,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.5/dom.generated.d.ts b/baselines/ts5.5/dom.generated.d.ts index aef6f6750..c5730a5a9 100644 --- a/baselines/ts5.5/dom.generated.d.ts +++ b/baselines/ts5.5/dom.generated.d.ts @@ -12002,7 +12002,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -12194,7 +12194,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.5/serviceworker.generated.d.ts b/baselines/ts5.5/serviceworker.generated.d.ts index e7aa90dc7..e45540610 100644 --- a/baselines/ts5.5/serviceworker.generated.d.ts +++ b/baselines/ts5.5/serviceworker.generated.d.ts @@ -3054,7 +3054,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3239,7 +3239,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.5/sharedworker.generated.d.ts b/baselines/ts5.5/sharedworker.generated.d.ts index ad5d84c20..760e064ed 100644 --- a/baselines/ts5.5/sharedworker.generated.d.ts +++ b/baselines/ts5.5/sharedworker.generated.d.ts @@ -2835,7 +2835,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3020,7 +3020,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.5/webworker.generated.d.ts b/baselines/ts5.5/webworker.generated.d.ts index f06292a87..e93737389 100644 --- a/baselines/ts5.5/webworker.generated.d.ts +++ b/baselines/ts5.5/webworker.generated.d.ts @@ -3561,7 +3561,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3746,7 +3746,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.6/dom.generated.d.ts b/baselines/ts5.6/dom.generated.d.ts index 3138a8b64..6ba70be14 100644 --- a/baselines/ts5.6/dom.generated.d.ts +++ b/baselines/ts5.6/dom.generated.d.ts @@ -12010,7 +12010,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -12202,7 +12202,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.6/serviceworker.generated.d.ts b/baselines/ts5.6/serviceworker.generated.d.ts index e7aa90dc7..e45540610 100644 --- a/baselines/ts5.6/serviceworker.generated.d.ts +++ b/baselines/ts5.6/serviceworker.generated.d.ts @@ -3054,7 +3054,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3239,7 +3239,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.6/sharedworker.generated.d.ts b/baselines/ts5.6/sharedworker.generated.d.ts index ad5d84c20..760e064ed 100644 --- a/baselines/ts5.6/sharedworker.generated.d.ts +++ b/baselines/ts5.6/sharedworker.generated.d.ts @@ -2835,7 +2835,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3020,7 +3020,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.6/webworker.generated.d.ts b/baselines/ts5.6/webworker.generated.d.ts index f06292a87..e93737389 100644 --- a/baselines/ts5.6/webworker.generated.d.ts +++ b/baselines/ts5.6/webworker.generated.d.ts @@ -3561,7 +3561,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3746,7 +3746,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.9/dom.generated.d.ts b/baselines/ts5.9/dom.generated.d.ts index 2c94c0304..ad495fd39 100644 --- a/baselines/ts5.9/dom.generated.d.ts +++ b/baselines/ts5.9/dom.generated.d.ts @@ -12010,7 +12010,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -12202,7 +12202,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.9/serviceworker.generated.d.ts b/baselines/ts5.9/serviceworker.generated.d.ts index 42cc0a76c..c58858f2f 100644 --- a/baselines/ts5.9/serviceworker.generated.d.ts +++ b/baselines/ts5.9/serviceworker.generated.d.ts @@ -3054,7 +3054,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3239,7 +3239,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.9/sharedworker.generated.d.ts b/baselines/ts5.9/sharedworker.generated.d.ts index d1ba1c70d..9fe996fc9 100644 --- a/baselines/ts5.9/sharedworker.generated.d.ts +++ b/baselines/ts5.9/sharedworker.generated.d.ts @@ -2835,7 +2835,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3020,7 +3020,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/ts5.9/webworker.generated.d.ts b/baselines/ts5.9/webworker.generated.d.ts index b97d90878..99b9de107 100644 --- a/baselines/ts5.9/webworker.generated.d.ts +++ b/baselines/ts5.9/webworker.generated.d.ts @@ -3561,7 +3561,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3746,7 +3746,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index 07959870c..82f012dd5 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -3564,7 +3564,7 @@ interface DOMMatrix extends DOMMatrixReadOnly { declare var DOMMatrix: { prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrix; /** * The **`fromFloat32Array()`** static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values. * @@ -3749,7 +3749,7 @@ interface DOMMatrixReadOnly { declare var DOMMatrixReadOnly: { prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; + new(init?: string | number[] | Float32Array | Float64Array): DOMMatrixReadOnly; /** * The **`fromFloat32Array()`** static method of the DOMMatrixReadOnly interface creates a new DOMMatrixReadOnly object given an array of single-precision (32-bit) floating-point values. * diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index 8dabe6754..9d6bd8a2c 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -275,6 +275,38 @@ } } }, + "DOMMatrix": { + // Browsers still accept typed arrays in the constructor, and MDN documents + // `Float32Array` / `Float64Array` variants. The current spec IDL only lists + // `sequence`, so the support must be added via override. + // https://github.com/microsoft/TypeScript/issues/60862 + "constructor": { + "signature": { + "0": { + "param": [ + { + "name": "init", + "additionalTypes": ["Float32Array", "Float64Array"] + } + ] + } + } + } + }, + "DOMMatrixReadOnly": { + "constructor": { + "signature": { + "0": { + "param": [ + { + "name": "init", + "additionalTypes": ["Float32Array", "Float64Array"] + } + ] + } + } + } + }, "HTMLElement": { "properties": { "property": { diff --git a/unittests/files/dommatrix.ts b/unittests/files/dommatrix.ts new file mode 100644 index 000000000..c36424ab3 --- /dev/null +++ b/unittests/files/dommatrix.ts @@ -0,0 +1,11 @@ +// DOMMatrix constructor accepts typed arrays in all browsers. +// https://github.com/microsoft/TypeScript/issues/60862 +new DOMMatrix(new Float32Array(16)); +new DOMMatrix(new Float64Array(16)); +new DOMMatrixReadOnly(new Float32Array(16)); +new DOMMatrixReadOnly(new Float64Array(16)); + +// Existing overloads keep working. +new DOMMatrix(); +new DOMMatrix("matrix(1, 0, 0, 1, 0, 0)"); +new DOMMatrix([1, 0, 0, 1, 0, 0]);