4

when I createhe react typescript project with vite in VScode, there are always the fellowing errors in App.tsx.

Property 'div' does not exist on type 'JSX.IntrinsicElements'.
Property 'a' does not exist on type 'JSX.IntrinsicElements'.Property 'img' does not exist on type 'JSX.IntrinsicElements'.

I create the project with vite npm create vite@latest npm install npm i -D @types/react-dom

It can run in the browser, but there are always error in the vscode. I have tryed some solutions, but it doesn't work.

There are also some error in tsconfig.json

Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy.
Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy.
Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy.

I will put the App.js and tsconfig.json in the attachement.

Typescript complains Property does not exist on type 'JSX.IntrinsicElements' when using React.createClass?

typescript suddenly yelling at me about all p tags - "property 'p' does not exist on type 'JSX.IntrinsicElements'

Wei WANG
  • 41
  • 2

1 Answers1

5

TL;DR: Make sure that your Visual Studio Code is up to date (Version 1.77+)

Hi, I found your question while looking for a solution for this myself. Figured I'd come back and leave you a reply since I found a fix that worked for me.

This answer to a similar question worked for me in the end. All I had to do was update my VSCode to version 1.78 as I was using version 1.71. You can refer to the original answer for an explanation of why this caused an issue, but updating your VSCode should fix your issue

Hope this fixes it for you!

elibry
  • 51
  • 2