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

Updating Types #1509

Merged
merged 3 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
### Added
### Fixed
* Fix BMP issues. (#1497)
* Update typings to support jpg and addPage on NodeCanvasRenderingContext2D (#1509)

2.6.1
==================
Expand Down
14 changes: 7 additions & 7 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class Canvas {
/** Constant used in PNG encoding methods. */
readonly PNG_FILTER_PAETH: number

constructor(width: number, height: number, type?: 'pdf'|'svg')
constructor(width: number, height: number, type?: 'image'|'pdf'|'svg')

getContext(contextId: '2d', contextAttributes?: NodeCanvasRenderingContext2DSettings): NodeCanvasRenderingContext2D

Expand Down Expand Up @@ -126,12 +126,6 @@ export class Canvas {
toDataURL(mimeType: 'image/jpeg', config: JpegConfig, cb: (err: Error|null, result: string) => void): void
/** _Non-standard._ */
toDataURL(mimeType: 'image/jpeg', quality: number, cb: (err: Error|null, result: string) => void): void

/**
* 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
}

declare class NodeCanvasRenderingContext2D extends CanvasRenderingContext2D {
Expand Down Expand Up @@ -212,6 +206,12 @@ declare class NodeCanvasRenderingContext2D extends CanvasRenderingContext2D {
createPattern(...args: any[]): NodeCanvasCanvasPattern
createLinearGradient(x0: number, y0: number, x1: number, y1: number): NodeCanvasCanvasGradient;
createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): NodeCanvasCanvasGradient;

/**
* 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
Collaborator

Choose a reason for hiding this comment

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

Oops, good catch. Can you delete the incorrect declaration from line 130-134 (I had it on the Canvas instance instead of the rendering context) please? You could also copy the text from it that describes the default width/height values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

}
export { NodeCanvasRenderingContext2D as CanvasRenderingContext2D }

Expand Down