Skip to content

Commit 34129f4

Browse files
committed
fix: resolve cairo issues
1 parent cf3fc9b commit 34129f4

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/main.ts.template

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ import { \
1212
Image as NativeImage, \
1313
loadImage, \
1414
registerFont as loadFont, \
15-
type Canvas as NativeCanvas, \
16-
type CanvasRenderingContext2D as NativeCanvasRenderingContext2D, \
1715
type ImageData, \
1816
type JpegConfig, \
1917
type JPEGStream, \
20-
type PdfConfig, \
18+
type Canvas as NativeCanvas, \
19+
type CanvasRenderingContext2D as NativeCanvasRenderingContext2D, \
2120
type PDFStream, \
21+
type PNGStream, \
22+
type PdfConfig, \
2223
type PngConfig, \
23-
type PNGStream \
24+
type TextMetrics \
2425
} from 'canvas';
2526
// IF(NAPI_RS): \
2627
import { \
@@ -2152,11 +2153,14 @@ export class Canvas {
21522153
public toBufferAsync(mimeType: 'application/pdf', config?: PdfConfig): Promise<Buffer>; \
21532154
public toBufferAsync(...args: readonly any[]): Promise<Buffer> { \
21542155
return new Promise<Buffer>((resolve, reject) => \
2155-
// @ts-expect-error: Complains about invalid overload (expects more than 0 overloads). \
2156-
this.canvas.toBuffer((error: Error | null, buffer: Buffer | null): void => { \
2157-
if (error) reject(error); \
2158-
else resolve(buffer!); \
2159-
}, ...args) \
2156+
this.canvas.toBuffer( \
2157+
// @ts-expect-error: Complains about invalid overload (expects more than 0 overloads). \
2158+
(error: Error | null, buffer: Buffer | null): void => { \
2159+
if (error) reject(error); \
2160+
else resolve(buffer!); \
2161+
}, \
2162+
...args \
2163+
) \
21602164
); \
21612165
}
21622166
// IF(SKIA): \

0 commit comments

Comments
 (0)