In a vue project, this is my tsconfig file:
{
"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"], <-- If i remove this line, I get warnings in vue and .ts files
"forceConsistentCasingInFileNames": false,
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"allowJs": true,
"outDir": "target",
"noImplicitAny": false,
"types": ["vite/client"],
"strictNullChecks": false,
}
}
If my target is ES2021, I was expecting to be able to use ES2021 features without getting errors (ex: "resresr sdf".replaceAll(" ", "") is not a function). However it seems that I have to add "lib":["ES2021", "DOM"] to get rid of the error. Why do I have to add lib 2021?
Note that I am using Volar extension with takeover mode (https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode) and have disabled Typescript vscode extension as per their recommendation. However before I did this, I was also getting the same warning.
I have tried restarting the Volar server in between making the changes and still no luck...
Thanks!
