I created a new UmiJS project today, getting a never seen error from Intellij IDEA.
Property 'div' does not exist on type 'JSX.IntrinsicElements'.
This error is intriguing, how could a div not exist in JSX.IntrinsicElements? I checked the node_modules folder, the @types/react package is surely there.
After comparing it with one of my existing project, I found that the new UmiJS project is using bundler as its moduleResolution in the extended ts-config file(./src/.umi/tsconfig.json):
{
"compilerOptions": {
"moduleResolution": "bundler"
}
}
Intellij IDEA highlighted the value and says String violates the pattern. I suspect that this is the reason why Intellij IDEA cannot resolve the @types/react package.
So, I override it in my tsconfig.json file with node, problem solved.
{
"compilerOptions": {
"moduleResolution": "node"
}
}