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

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

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 6
  • Comments: 17 (1 by maintainers)

Most upvoted comments

change the "moduleResolution": "Node" in tsconfig.json

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

image

Source: https://github.com/microsoft/TypeScript/issues/52396#issuecomment-1404056467