Closed rpasechnikov closed 1 year ago
Start a new pull request in StackBlitz Codeflow.
Ok so it seeks 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.
Is your VS code up to date? For me the latest version support TS 5 bundler resolution (I'm surprised they use the bundled version instead of the locally installed version...)
cc @patak-dev can you see on updating the version use on stackblitz?
That ended up being it! Updating VS Code did the trick. Still unsure why the issue is present in the first place and why is it also present in the online sandbox environment, but I'm glad I've got a way forward.
Thanks for your help! :)
i tried in stackblitz and the issue still exist
I've ran into the same issue and indeed updating VSCode solved the validation error.
Upgraded from:
Version: 1.71.0 (system setup)
Version: 1.78.2 (system setup)
The bundler module resolution is a new feature only work on Typescript 5.x.
Try to update latest typescript with the following command.
npm update typescript -g
or
npm install typescript@latest -g
Ok so it seeks 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.
I'm using neovim not vscode, so the vscode update doesn't apply for me.
The typescript in my package.json that gets generated by vite was already v5 (5.0.2). I updated to typescript@latest which gave me 5.04, but that didn't help.
Updating vim plugins (PlugUpdate) and CoC plugins (CocUpdate) didn't seem to resolve it.
Changing my tsconfig.json "moduleResolution" from "bundler" to "node" or "nodenext" makes it work.
@willxy probably an issue with your IDE/plugins not supporting/using TS 5. Using moduleResolution
node
in the meantime is a good solution
Ok so it seeks 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.
This worked for me. Also I updated my VSCode to version 1.78
Thanks!
FYI, the issue in StackBlitz with the react template has been fixed. See https://vite.new/react-ts
Describe the bug
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.
Reproduction
https://stackblitz.com/edit/vitejs-vite-azsc25?file=src%2FApp.tsx&terminal=dev
Steps to reproduce
Property 'div' does not exist on type 'JSX.IntrinsicElements'.(2339)
System Info
Used Package Manager
npm
Logs
No response
Validations