Skip to content

Commit

Permalink
fix: resolve cairo issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet committed May 22, 2024
1 parent cf3fc9b commit 34129f4
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main.ts.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ import { \
Image as NativeImage, \
loadImage, \
registerFont as loadFont, \
type Canvas as NativeCanvas, \
type CanvasRenderingContext2D as NativeCanvasRenderingContext2D, \
type ImageData, \
type JpegConfig, \
type JPEGStream, \
type PdfConfig, \
type Canvas as NativeCanvas, \
type CanvasRenderingContext2D as NativeCanvasRenderingContext2D, \
type PDFStream, \
type PNGStream, \
type PdfConfig, \
type PngConfig, \
type PNGStream \
type TextMetrics \
} from 'canvas';
// IF(NAPI_RS): \
import { \
Expand Down Expand Up @@ -2152,11 +2153,14 @@ export class Canvas {
public toBufferAsync(mimeType: 'application/pdf', config?: PdfConfig): Promise<Buffer>; \
public toBufferAsync(...args: readonly any[]): Promise<Buffer> { \
return new Promise<Buffer>((resolve, reject) => \
// @ts-expect-error: Complains about invalid overload (expects more than 0 overloads). \
this.canvas.toBuffer((error: Error | null, buffer: Buffer | null): void => { \
if (error) reject(error); \
else resolve(buffer!); \
}, ...args) \
this.canvas.toBuffer( \
// @ts-expect-error: Complains about invalid overload (expects more than 0 overloads). \
(error: Error | null, buffer: Buffer | null): void => { \
if (error) reject(error); \
else resolve(buffer!); \
}, \
...args \
) \
); \
}
// IF(SKIA): \
Expand Down

0 comments on commit 34129f4

Please sign in to comment.