#Typescript errors out the box -- vite & next.js

12 messages · Page 1 of 1 (latest)

wise bridge
#

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?

tidal tusk
#

Just a blind guess, what version of TS is your VS Code using?

wise bridge
#

4.9.5

tidal tusk
#

In status bar you can change the TS version to the same version as your project's.

wise bridge
#

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" }]
}
tidal tusk
#

I'm not familiar with Next.js

wise bridge
#

No worries

tidal tusk
#

Your package.json should have a script that type checks using tsc, run that and see if there are errors there too.

last coral
#

@wise bridge In additioon to what Burrito said, showing some example errors might help.

wise bridge
#

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