Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'div' does not exist on type 'JSX.IntrinsicElements'. #14011

Closed
7 tasks done
ZacharyBear opened this issue Aug 3, 2023 · 17 comments
Closed
7 tasks done

Property 'div' does not exist on type 'JSX.IntrinsicElements'. #14011

ZacharyBear opened this issue Aug 3, 2023 · 17 comments

Comments

@ZacharyBear
Copy link

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

@stackblitz
Copy link

stackblitz bot commented Aug 3, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@welpie21
Copy link

welpie21 commented Aug 3, 2023

Hello, Not sure if you are using the code within StackBlitz or vscode or other IDE.

When you do pnpm create vite@latest and select one of the options that provides a typescript solution. After you've done you have to install the dependencies after the react vite project has been created.

A new folder appears called node_modules and I do not see it appear in StackBlitz ( even when I run npm install ) which is needed to reference the types to make sure typescript works correctly with the IDE.

When I create the project locally on my computer and run npm install or pnpm install I do not get the errors what you get. So check if stackblitz doesn't have any issues.

@ZacharyBear
Copy link
Author

ZacharyBear commented Aug 3, 2023 via email

@glompix
Copy link

glompix commented Aug 4, 2023

This happens to me out of the box with the unmodified template using yarn 3. This is not StackBlitz, just the Mac Mini sitting on my desk. Editor is a non-factor. Feels like a PnP issue.

❯ node --version
v16.15.1

❯ yarn create vite --template react-ts
❯ cd vite-project
❯ yarn
❯ yarn build

[... a bunch of "Cannot find module 'react'"-type errors]

Found 28 errors in 2 files.

Errors  Files
    25  src/App.tsx:1
     3  src/main.tsx:1

@ZacharyBear
Copy link
Author

ZacharyBear commented Aug 4, 2023

Actually Vite haven‘t give me an error, it‘s just an Editor warning. But when I use NextJS, they got no problem about this.😥

@Leandrocoelho1
Copy link

Leandrocoelho1 commented Aug 12, 2023

Actually Vite haven‘t give me an error, it‘s just an Editor warning. But when I use NextJS, they got no problem about this.😥

@ZenkieBear I was having the same errors on VSCode and updating it solved for me.

@ZacharyBear
Copy link
Author

ZacharyBear commented Aug 12, 2023 via email

@ajraduenz
Copy link

Similar issue here when I started a new vite project using npm create vite@latest, Node v18.17.1, Typescript 5.1.6
image

@namanyash
Copy link

namanyash commented Aug 15, 2023

Stuck on a similar issue.

yarn dev command works and I can see my app on local server but yarn build fails.

image

@wangxiaolei5
Copy link

Similar issue here when I started a new vite project using pnpm create vite@latest, Node v16.14.0, Pnpm 7.4.0,Typescript 5.1.6
企业微信截图_16922567292542

@sachila
Copy link

sachila commented Aug 18, 2023

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

@Universe-stack
Copy link

Just encountered same problem on my machine..

@sisco0
Copy link

sisco0 commented Sep 5, 2023

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

This was the correct answer for me. I used Neovim + CoC.nvim with coc-tsserver. Worked fine after the modification.

@sapphi-red
Copy link
Member

sapphi-red commented Sep 20, 2023

Closing as this seems to be fixed in stackblitz repro.

@ZacharyBear
Copy link
Author

Similar issue here when I started a new vite project using pnpm create vite@latest, Node v16.14.0, Pnpm 7.4.0,Typescript 5.1.6 企业微信截图_16922567292542

哥们,你这有水印,小心点

@AljazOblonsek
Copy link

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: microsoft/TypeScript#52396 (comment)

@huajianduzhuo
Copy link

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: microsoft/TypeScript#52396 (comment)

Brilliant!

@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests