Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
andrewgreenh opened this issue May 4, 2022 · 0 comments · Fixed by #46
Closed

Comments

@andrewgreenh
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant