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".