Hi, every project I create using vite/react, or next.js CLI using their preconfigured typescript project starts out with bunch of typescript errors out the box. Every tutorial I see simply uses their CLI to start these typescript projects with no issue but it's not working for me. I have tried resinstalling VSCode but I am not sure what is going on. Has anyone had this issue before?
#Typescript errors out the box -- vite & next.js
12 messages · Page 1 of 1 (latest)
Just a blind guess, what version of TS is your VS Code using?
4.9.5
In status bar you can change the TS version to the same version as your project's.
VSCode and the workspace are both using the same versions. Unfortunately, still the same issue.
this is my tsconfig.json
{
"compilerOptions": {
"target": "ESNext",
"types": [
"vite/client",
"node",
],
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": ["src/**/*/*.ts", "src/**/*/*.tsx"],
"references": [{ "path": "./tsconfig.node.json" }]
}
I'm not familiar with Next.js
No worries
Your package.json should have a script that type checks using tsc, run that and see if there are errors there too.
@wise bridge In additioon to what Burrito said, showing some example errors might help.
It was a very weird issue. I tried everything. Then gave up. Then opened VScode again, and it was gone. I think VSCode for some reason was being stubborn