Skip to content

Commit

Permalink
add missing DOMMatrixInit and DOMPointInit types
Browse files Browse the repository at this point in the history
this was accidentally relying on people importing ambient DOM
declarations
  • Loading branch information
chearon committed Dec 31, 2024
1 parent 8346512 commit f84c99e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,16 @@ export class JPEGStream extends Readable {}
/** This class must not be constructed directly; use `canvas.createPDFStream()`. */
export class PDFStream extends Readable {}

// TODO: this is wrong. See matrixTransform in lib/DOMMatrix.js
type DOMMatrixInit = DOMMatrix | string | number[];

interface DOMPointInit {
w?: number;
x?: number;
y?: number;
z?: number;
}

export class DOMPoint {
w: number;
x: number;
Expand Down
2 changes: 2 additions & 0 deletions lib/DOMMatrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class DOMPoint {
}

matrixTransform(init) {
// TODO: this next line is wrong. matrixTransform is supposed to only take
// an object with the DOMMatrix properties called DOMMatrixInit
const m = init instanceof DOMMatrix ? init : new DOMMatrix(init)
return m.transformPoint(this)
}
Expand Down

0 comments on commit f84c99e

Please sign in to comment.