embiem / react-canvas-draw

React Component for drawing in canvas
https://embiem.github.io/react-canvas-draw/
MIT License
902 stars 315 forks source link

Property 'getDataURL' does not exist on type 'CanvasDraw' #143

Open leeprobert opened 2 years ago

leeprobert commented 2 years ago

This is a typescript issue I think. I can see the method exists but it hasn't been added to the index.d.ts file that tells the compiler they are available. I tried to manually edit the file to include the signature but it still complains that: Property 'getDataURL' does not exist on type 'CanvasDraw' I think there are other methods missing from the type declaration. The Typescript support needs a bit of work.

leeprobert commented 2 years ago

This is how you can bypass the compiler issues for just that one line of code:

// @ts-ignore: Unreachable code error
                let imageURL = canvasDrawRef.getDataURL('png', false, '0xffffff');