While using WebStorm to code, I ran into an issue with my import statement:
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
What is happening is the Jetbrains IDE isĀ reading the type fileĀ for the package fromĀ /jetbrains/intellij/javascript/typings instead of the project'sĀ node_modules folder.
This happens because the IDE downloads typings for libraries to its configuration folder to enhance code completion.
Luckily, I found threads discussing this issue on stackoverflow, and what was shared worked to resolve the issue.
Here's what to do:
In the IDE, double tap shift two timesĀ to open the search everywhere window, search forĀ registryĀ and open the Registry... result.
In the registry, removeĀ react-router-dom from the value field of the typescript.external.type.defintions.packagesĀ key.
Finally, click File => Invalidate Caches, then check Clear file system cache and Local History, then click Invalidate and Restart.
This change will ensure the IDE will read the type file from the node_modules folder instead of the internal typings folder. FYI, this registry is "IDE level", not "project level".