So my problem is that TypeScript suddenly can’t find the standard types in my nextjs 14 application.
The application works without problems, but VSCode displays errors in almost every file because it cannot find the array type of TS, for example. I use WSL 2 (if that is important).
So I get no runtime errors, it is just displayed in vscode as error.
My tsconfig.json:
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
error message of tsconfig.json
Error Message:
Cannot find global type ‘Boolean’.ts
Cannot find global type ‘CallableFunction’.ts
Cannot find global type ‘IArguments’.ts
Cannot find global type ‘NewableFunction’.ts
Cannot find global type ‘Number’.ts
Cannot find global type ‘Object’.ts
I have already removed the Typescript Module and added it again, created a new project to see if the error exists there as well. However, nothing worked and the error also exists in the new project.
I have already tried to delete the cache from pnpm. Unfortunately nothing worked.
JiggyJaggy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.