TypeScript error "Could not find a declaration file for module"
danitatt opened this issue · 1 comments
Describe the bug
Could not find a declaration file for module 'click-to-react-component'. This error appears if tsconfig.json is set to "strict": true
To Reproduce
Steps to reproduce the behavior:
- Init new project with Vite (React + typescript + SWC)
npm create vite@latest
- Install click-to-react-component
npm i click-to-react-component
- Import click-to-react-component in main.tsx
- See typescript error
Expected behavior
No typescript error in VS Code.
Error from TypeScript
Could not find a declaration file for module 'click-to-react-component'. '/Users/danitatt/Work/nnp/app/node_modules/click-to-react-component/src/index.js' implicitly has an 'any' type. There are types at '/Users/danitatt/Work/nnp/app/node_modules/click-to-react-component/src/types.d.ts', but this result could not be resolved when respecting package.json "exports". The 'click-to-react-component' library may need to update its package.json or typings.
Thanks for the great tool!
Seeing the same problem, could be worked around with // @ts-expect-error
but would be nice to get this fixed :)