vite: Property 'div' does not exist on type 'JSX.IntrinsicElements'.
Describe the bug
This problem will appear when I use vite build a react-ts
project.
When I write some HTML element in JSX, IDE will always prompt Property '...' does not exist on type 'JSX.IntrinsicElements'.
. I‘d not change anything, it‘s just a default project create by vite.
Actually, the react-ts template preset provided on the vite official website also within this problem.
Reproduction
https://stackblitz.com/edit/vitejs-vite-88gtsm?file=index.html&terminal=dev
Steps to reproduce
No response
System Info
System: Windows 11
Binaries: Default packages provided by vite(react-ts template)
Browser: Chrome 115.0.5790.110
IDE: VSCode
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 6
- Comments: 17 (1 by maintainers)
change the
"moduleResolution": "Node"
in tsconfig.jsonFor anyone else that might have this problem. Setting workspace typescript version in VS Code solved it for me:
In the VS Code command palette, run the
TypeScript: Select TypeScript version command.
Make sure you have Use Workspace version selected.Source: https://github.com/microsoft/TypeScript/issues/52396#issuecomment-1404056467