ZweiEuro
ZweiEuro
DDeno
Created by ZweiEuro on 11/19/2024 in #help
Intellisense not working for typescript react.
I ran this to create a new Vite React project: What I did:
deno run -A npm:create-vite@latest --template react-ts
deno install
deno task dev
deno run -A npm:create-vite@latest --template react-ts
deno install
deno task dev
But the type sensing was wrong, there also was no deno.json so i created one:
{
"imports": {
"react": "npm:react@^18.3.1",
"react-dom": "npm:react-dom@^18.3.1"
},
"compilerOptions": {
"lib": [
"dom"
],
"jsx": "react-jsx",
"jsxImportSource": "react",
"types": [
"npm:@types/react",
"npm:@types/react-dom"
]
}}
{
"imports": {
"react": "npm:react@^18.3.1",
"react-dom": "npm:react-dom@^18.3.1"
},
"compilerOptions": {
"lib": [
"dom"
],
"jsx": "react-jsx",
"jsxImportSource": "react",
"types": [
"npm:@types/react",
"npm:@types/react-dom"
]
}}
But the type sensing is still wrong, for very simple code like const [count, setCount] = useState<number>(0); VsCode does not detect count or setCount to be of type number, and it complains that useState has no type argument.
6 replies
DDeno
Created by ZweiEuro on 11/18/2024 in #help
Start a new Vite React project
Hi! Should https://docs.deno.com/runtime/tutorials/how_to_with_npm/react/ work out of the box? I am trying to get it to run with vscode but even if it runs there are a lot of small problems with it out of the box: - svgs are not recognized as valid resources - the react UMD is missing so everything is recognized as an error - doesn't generate a deno.json for me at all - seems in general that a lot of types and intellisense are setup incorrectly ? I have no other plugin active other than dino What I did:
deno run -A npm:create-vite@latest --template react-ts
deno install
deno task dev
deno run -A npm:create-vite@latest --template react-ts
deno install
deno task dev
1 replies