Component properties auto-complete fails for react project in IntelliJ Idea Ultimate.

Answered

In react project, component properties are not shown in auto suggestion while in VS Code it shows.

Also notice the error shown in VS Code is just below (line 9) marking red color but in IntelliJ it showing at line 22.

7 comments
Comment actions Permalink

Hi Rohit - can you share a demo project where this can be reproduced?

0
Comment actions Permalink

Arina Efremova As I can't upload zip file here but it is easy to reproduce. 

  1. Create a fresh project using create-react-app or IntelliJ.
  2. Add "react-select": "^4.3.1" dependency in package.json file.
  3. import import AsyncSelect from 'react-select/async'; in App.js.
  4. Use the AsyncSelect component inside the return of function and you'll see that there is no suggestions for properties of AsyncSelect component in IntelliJ.
0
Comment actions Permalink

Installing react-select typings (using npm install @types/react-select, or via the intention available on Alt+Enter - see https://www.jetbrains.com/help/idea/configuring-javascript-libraries.html#ws_jsconfigure_libraries_ts_definition_files) should help:

This is exactly what VSCode does behind the scene to enhance the completion

0
Comment actions Permalink

Elena Pogorelova Thanks for answering. I tried and yes it is working. Now I want to know is there any settings that will auto download of @types for all libraries in package.json automatically so that I need not to do it manually every time just like VS Code?

0
Comment actions Permalink

Actually this feature is there, but it's enabled by a subset of known widely used libraries only: if a package is specified in the package.json dependencies list AND listed in typescript.external.type.definitions.packages. key in Registry (Help > Find Action..., enter registry... to locate it), then the typings are downloaded automatically in background

0
Comment actions Permalink

Elena Pogorelova Ok, but it defeats the purpose, every time I add new library, I had to add in that registry. Is there any value that can be set to that registry so that it enables to download any library from package.json and need not to explicitly mention anywhere.

0
Comment actions Permalink

No, there are no such settings

0

Please sign in to leave a comment.