Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DOMMatrix/DOMPoint): align to spec #2427

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ShaMan123
Copy link

DOMMatrix/DOMPoint were missing a few neglible methods as per the spec/d.ts files

This PR aligns to it.

Note that running npm run tsd throws:

  index.test-d.ts:7:0
  ✖  7:0  Parameter type { new (init?: string | number[] | undefined): DOMMatrix; prototype: DOMMatrix; fromFloat32Array(array32: Float32Array): DOMMatrix; fromFloat64Array(array64: Float64Array): DOMMatrix; fromMatrix(other?: DOMMatrixInit | undefined): DOMMatrix; } is not identical to argument type typeof DOMMatrix.  
  ✖  8:0  Parameter type DOMMatrix is not identical to argument type DOMMatrix.                                                                                                                                                                                                                                                  
  ✖  9:0  Parameter type { new (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined): DOMPoint; prototype: DOMPoint; fromPoint(other?: DOMPointInit | undefined): DOMPoint; } is not identical to argument type typeof DOMPoint.                                                      

  3 errors

However running the following succeeds:

npx tsc ./index.test-d.ts --noEmit 

Copy link
Author

@ShaMan123 ShaMan123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I would like to suggest adding the following to the index.js file:

Object.assign(global, { DOMPoint, DOMMatrix })

This way projects using node-canvas and browser/offscreen native canvas with DOMPoint, DOMMatrix can be integrated seamlessly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant