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

Add missing typescript type definitions #689

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

programmer24601
Copy link

@programmer24601 programmer24601 commented Jul 11, 2023

This PR closes issue #659

* For PDF canvases, adds another page. If width and/or height are omitted,
* the canvas's initial size is used.
*/
addPage(width?: number, height?: number): void
Copy link
Contributor

Choose a reason for hiding this comment

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

PDF is not supported in this library though 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

@programmer24601 programmer24601 Jul 12, 2023

Choose a reason for hiding this comment

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

Apologies I should have clarified this.

The following types were directly copied from skia-canvas which this project depends on:

GlobalCompositeOperation
CanvasLineCap
CanvasLineJoin
CanvasTextBaseline
CanvasTextAlign
TextMetrics
CanvasFillRule
CanvasRenderingContext2D
CanvasGradient
CanvasPattern

It is correct to be bringing in these types, but as you rightfully point out, this library does not currently implement all features. I was reluctant to start removing type properties / class methods as I'm uncertain which are, and are not, implemented. I'm hoping someone with more experience (i.e. the maintainers) can help out here.

The only modifications I've made are to CanvasRenderingContext2D:

  1. To add method setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void in addition to the existing setTransform(transform?: DOMMatrix2D): void
  2. To modify fill(fillRule?: CanvasFillRule): void to fill(path?: Path2D, fillRule?: CanvasFillRule): void

These changes now allow my project to build (tsc) where before it was failing (as described in #659).

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.

3 participants