ericclemmons / click-to-component

Option+Click React components in your browser to instantly open the source in VS Code
MIT License
1.94k stars 75 forks source link

TypeScript error "Could not find a declaration file for module" #83

Closed danitatt closed 3 weeks ago

danitatt commented 6 months ago

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:

  1. Init new project with Vite (React + typescript + SWC) npm create vite@latest
  2. Install click-to-react-component npm i click-to-react-component
  3. Import click-to-react-component in main.tsx
  4. See typescript error

Expected behavior No typescript error in VS Code.

Screenshots

Снимок экрана 2024-05-15 в 23 42 41

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!

alexgorbatchev commented 5 months ago

Seeing the same problem, could be worked around with // @ts-expect-error but would be nice to get this fixed :)