ericclemmons / click-to-component

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

Cannot find module './src/ClickToComponent' or its corresponding type declarations. #40

Closed andrewgreenh closed 2 years ago

andrewgreenh commented 2 years ago

Hey everyone :) I encountered a small TypeScript problem when working with react-click-to-component:

Describe the bug Running the typescript compiler with "skipLibCheck": false will result in the following error:

node_modules/click-to-react-component/src/types.d.ts:1:34 - error TS2307: Cannot find module './src/ClickToComponent' or its corresponding type declarations.

To Reproduce Steps to reproduce the behavior:

  1. Setup a new React project with TypeScript and use
  2. Make sure "skipLibCheck" is set to false
  3. Run the TypeScript compiler

Expected behavior No TSC errors should occur.

Screenshots

image

Additional context I guess this happens, because the path reference inside of types.d.ts does not exist. Since this path should be resolved relative to the current file, it looks for a src dir inside of src and will not find that.

A possible fix would be to move types.d.ts to the root directory, or to fix the path.