Closed
Description
Error:
Could not find a declaration file for module 'react-signature-canvas'. '../node_modules/react-signature-canvas/dist/index.mjs' implicitly has an 'any' type.
There are types at '../node_modules/react-signature-canvas/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'react-signature-canvas' library may need to update its package.json or typings.
Then I installed the types as yarn add @types/react-signature-canvas@latest --dev
import { useRef } from 'react';
import ReactSignatureCanvas from 'react-signature-canvas';
export const SignaturePad = () => {
const signatureCanvasRef = useRef(null);
return (
<div className='p-5'>
<ReactSignatureCanvas
ref={signatureCanvasRef}
canvasProps={{ className: 'w-full rounded-sm border-1 border-neutral-700' }}
/>
</div>
);
};
then I get
'ReactSignatureCanvas' cannot be used as a JSX component.
Its type 'typeof ReactSignatureCanvas' is not a valid JSX element type.
Types of construct signatures are incompatible.
Type 'new (props: ReactSignatureCanvasProps) => ReactSignatureCanvas' is not assignable to type 'new (props: any) => Component<any, any, any>'.
Construct signature return types 'ReactSignatureCanvas' and 'Component<any, any, any>' are incompatible.
The types returned by 'render()' are incompatible between these types.
Type 'import("/home/outside/projects/reset-one/node_modules/@types/react-signature-canvas/node_modules/@types/react/index").ReactNode' is not assignable to type 'React.ReactNode'.
Type 'ReactElement<unknown, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
Property 'children' is missing in type 'ReactElement<unknown, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.