No auto complete for the React-Redux in a React Native App


I've encountered a weird issue. I learn react native and I really appreciate autocompletion feautre. I use TypeScript. 

Autocompletion works for everything I used so far, excluding react-redux. In the screenshot, you can see that whereas functions imported from 'react' (eg useEffect) are highlighed, the {useSelector} isn't highlighed. With CTRL+click I can jump to 'useEffect' function or to 'react' and 'react-redux' files, but I cannot jump to useSelector function.

The thing is, it works. I can run my app via expo on a device and use redux. I've installed 'react-redux' and 'redux' in the same way as other third-parties, with 'yarn add' and 'yarn install'. I've found the useSelector in 'node_modules/react-redux/src/hooks/useSelector.js' so it does exist.

I tried:

  • install it via npm.
  • clean node_modules and install everything from scratch
  • rebuild index and restart

IntelliJ IDEA 2019.3.4 (Ultimate Edition)
Build #IU-193.6911.18, built on March 17, 2020
Licensed to Jacek Gajek
You have a perpetual fallback license for this version
Subscription is active until January 31, 2021
Runtime version: 11.0.6+8-b520.43 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.3.0-42-lowlatency
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 12
Registry: undo.documentUndoLimit=9999, js.debugger.webconsole=false
Non-Bundled Plugins: com.intellij.plugins.watcher, AutoConstructor, Base64 for IDEA and Storm, BashSupport, CMD Support, Dilbert, IdeaVIM, IvyIDEA, Lombook Plugin, Mongo Plugin, PlantUML integration, Pythonid, REST Client plugin, Statistic, YAML/Ansible support,, com.alayouni.ansiHighlight, com.bluewaitor.tsReact, org.jetbrains.kotlin, com.bruce.intellijplugin.generatesetter, com.deadlock.scsyntax, com.euphoricity.gitignore, com.github.beansoftapp.reatnative.idea, com.github.jk1.ytplugin, com.github.leomillon.uuidgenerator, com.github.syuchan1005.ImageComment, com.ifengxue.plugin.jpa-support, com.intellij.apacheConfig, com.intellij.bigdecimal-folding, com.intellij.ideolog, com.intellij.jira, com.intellij.plugins.html.instantEditing, com.intellij.react.css.modules, com.jetbrains.php, com.jetbrains.plugins.ini4idea, com.jinsihou.react.snippets, com.khmelyuk.multirun, com.linsage, com.potterhsu.jsonviewer, com.sburlyaev.terminal.plugin, com.tsunderebug.discordintellij,, de.u-mass.idea.copyConstructor, lk.chathurabuddi.jasper-report-supportn, luonq.ScrollFromSource,, marcglasberg.HibernateInspectionsPlugin, mobi.hsz.idea.gitignore, org.jetbrains.plugins.ruby, net.ashald.envfile, net.seesharpsoft.intellij.plugins.csv, nl.rubensten.texifyidea, org.github.plugin.redis-simple, org.intellij.RegexpTester, org.intellij.scala, org.sylfra.idea.plugins.linessorter, org.zalando.intellij.swagger, pl.lksztmczk.openinterminal, ru.adelf.idea.dotenv, send2terminal

评论操作 固定链接

Do you have @types/react-redux installed? Try adding it with npm: npm i @types/react-redux

评论操作 固定链接

It worked, thanks. Is there a general rule for that? Should all modules be installed with '@types/....' ?

评论操作 固定链接

yes, it's recommended - see

And it's 'must have' when working with Typescript, your code won't compile otherwise