Here is the tsconfig file for my Vue project:
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "src/**/*.json"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"target": "es2021",
"module": "ESNext",
"lib":["ES2021", "DOM"], <-- I found that adding this line resolved warnings in Vue and .ts files
"forceConsistentCasingInFileNames": false,
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"allowJs": true,
"outDir": "target",
"noImplicitAny": false,
"types": ["vite/client"],
"strictNullChecks": false,
}
}
I initially expected to be able to use ES2021 features without errors if my target was set to ES2021 (e.g., "resresr sdf".replaceAll(" ", "") causing a function error). However, it turns out that adding "lib":["ES2021", "DOM"] was necessary to eliminate the error. Why do I need to include lib 2021?
It's worth noting that I am utilizing the Volar extension with takeover mode (https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode) and have followed their recommendation to disable the TypeScript VSCode extension. Even when I had not disabled it, I still encountered the same warning.
I attempted restarting the Volar server after making changes, but unfortunately, the issue persists...
https://i.sstatic.net/jII6g.png
Thank you!