4

I enabled a webpack alias in my jsconfig.json file for VSCode.

But when I go to definition of a React component, I get 2 definitions:

  1. my react component
  2. an index.d.ts file of node_modules/@types/react

How do I get rid of the index.d.ts file ? Knowing that I use only jsx.

2

1 Answer 1

2

All of the components in the project are written using the React.FC type and are automatically exported.

One way to fix an issue with the "Goto Location: Multiple Definitions" feature in the Editor is to change the configuration from peek to goto.

enter image description here

This may hide some additional definitions that may be useful, but it will make the feature work as intended when clicking on components.

Sign up to request clarification or add additional context in comments.

2 Comments

Good! This is more of a workaround to the actual problem. Not sure how will this work when you have 2 legit definitions
This has made is so much worse for me now, 98% of the time I end up in the index.d.ts file. Any wat to remove index.d.ts files as a possible option?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.