1

I'm trying out Vite with React TS and using their official documentation. The app builds and runs, however viewing it in VS Code shows a whole bunch of Property 'div' does not exist on type 'JSX.IntrinsicElements'.ts(2339) errors.

I've created a new React TS application using npx create-react-app my-app --template typescript and am not getting this issue.

Looking at Vite documentation once again, they've got a stackblitz link that exhibits the same issue, so this means that this is not my environment that's the problem.

Am I missing something? Surely this should not be a problem for official Vite documentation? Please note however, that I'm new to React and Vite.

halfer
  • 19,824
  • 17
  • 99
  • 186
Web Dev
  • 2,677
  • 2
  • 30
  • 41

1 Answers1

1

Ok so it seems that updating the tsconfig.json from "moduleResolution": "bundler" to "moduleResolution": "node" resolves this. I don't yet fully understand what this does, neither do I understand why Vite does not create a compatible configuration out of the box. I'll response if/when I found out more.

Edit: updating VS Code fixed the issue

Web Dev
  • 2,677
  • 2
  • 30
  • 41
  • 1
    Seems not even to be so well documented what bundler is doing: https://www.typescriptlang.org/docs/handbook/module-resolution.html Here it says to strategies: Node or Classic but nothing about bundler – starking May 09 '23 at 19:27