Open leeprobert opened 2 years ago
Actually still getting errors with typescript
: Could not find a declaration file for module 'react-canvas-draw'
- the recommended resolution (above) didn't work after all.
The solution for typescript
is to add a file called type.d.ts
and put this line in it: declare module 'react-canvas-draw';
- that will be enough for the compiler to accept the import of the module.
If you need to start doing anything useful with this component in Typescript you'll have to start declaring all the types. My declaration file is currently:
import CanvasDraw from "react-canvas-draw";
// this is required for Typescript to recognise the CanvasDraw package
declare module 'react-canvas-draw'{
canvasDraw: CanvasDraw | null;
}
Had to
--force
the package to install underreact@18.1.0
and also had issues with Typescript types that was resolved withnpm i --save-dev @types/react-canvas-draw --force