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 1817109
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
### Changed
### Added
### Fixed
* Fixed accidental depenency on ambient DOM types


3.0.0
Expand Down
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 1817109

Please sign in to comment.