Open scarf005 opened 1 year ago
There's also a similar issue open in Vite recently without Deno: https://github.com/vitejs/vite/issues/13129. Not sure if it's related. There's also this Deno issue which seems to be the same: https://github.com/denoland/deno/issues/16653. The solution (https://github.com/denoland/deno/issues/16653#issuecomment-1383657630) worked a bit but there's still lingering TS errors.
cc @bartlomieju
Hi!
That sounds similar to an issue I had a few days ago. Updating moduleResolution
to node
(maybe others too) fixed it for me. Updating VS Code was ultimately the solution, which allowed me to roll back changes to moduleResolution
back to bundler
.
Thanks for the ping, I'll try to investigate this problem.
as a work-around I've disabled the path to my vite application (running on deno runtime) for deno.enablePaths
in .vscode/settings.json
.
I've created a deno-react
application using npm:create-vite-extra
❯ deno run --allow-read --allow-write --allow-env npm:create-vite-extra@latest
After I renamed src/main.jsx
to src/main.tsx
I had to change vite.config.mjs
to include npm:@types/react
import "npm:react@18.2.0";
import "npm:react-dom@18.2.0";
import "npm:react-router-dom@6.14.1";
try {
await import("npm:@types/react");
await import("npm:@types/react-dom");
} catch (ignore) {}
the imports need to be wrapped into a try-catch
because vite/deno complain about import problems, but the important thing is that ./node_modules/@types/react
exists for the normal vscode typescript LSP.
tsconfig.json
:
{
"compilerOptions": {
"moduleResolution": "Bundler",
"module": "ESNext",
"target": "ES2022",
"types": ["node"],
"lib": ["esnext", "dom"],
"jsx": "react",
"allowImportingTsExtensions": true,
"allowSyntheticDefaultImports": true,
"noEmit": true
}
}
I have the same issue, and @hastebrot 's solution didn't work for me. Can someone link me a working example?
Issue
JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
errors are popping OOTB.this may be related to https://github.com/denoland/deno/issues/9425.
How to reproduce
Scaffolding project in /home/scarf/repo/cata/vite-project...
Done. Now run:
cd vite-project deno task dev