Open Tolfx opened 3 years ago
The way to fix this issue was to use NodeCanvasRenderingContext2D
on the module augmentation, and CanvasRenderingContext2D
at runtime, as per https://github.com/Automattic/node-canvas/pull/1866#issuecomment-889656888.
However, that no longer works since https://github.com/Automattic/node-canvas/commit/4a891ef22c5bdf56f3284279d490f53a8f60f396
@zbjornson why was the commit reverted? And do you have any other workarounds?
Issue
Context2d
is not being exported insteadNodeCanvasRenderingContext2D
is.. This causes an issue when I want to add more methods to Context2d by using theprototype
.But once compiled an error happens on runtime saying
NodeCanvasRenderingContext2D
is undefined.Steps to Reproduce
But when using:
It runs without issues but compiler complains that
Module '"canvas"' has no exported member 'Context2d'
.Your Environment