Reputation: 251
Does anybody know how to fix this tsconfig error?
Flag 'importsNotUsedAsValues' is deprecated and will stop functioning in TypeScript 5.5. Specify 'ignoreDeprecations: "5.0"' to silence this error. Use 'verbatimModuleSyntax' instead.
I use vscode and created new Vue project instance using Vite
Not sure if I should silence this error or there is a specific solution on how to edit tsconfig?
Upvotes: 25
Views: 34195
Reputation: 843
If you expect the project shouldn't have this error (e.g., you cloned a known good repo) and get this error in VS Code, it could be because the project is using an older Typescript version than VS Code is configured for. In this case, the ignoreDeprecations
in compilerOptions
solution by MRAH may not help.
You can navigate in the command palette to "TypeScript: Select TypeScript Version" and select the typescript version your project workspace uses:
You can also select this by clicking on the "TypeScript" banner in the status bar:
then Switch Version.
Upvotes: 4
Reputation: 1
mine was restricted by the network(domain) i was, changing toprivate then worked fine.
Upvotes: 0
Reputation: 269
Had the same issue, got it fixed using this workaround from the GitHub issue:
If you're using @vue/tsconfig/tsconfig.web.json
or similar, you can reset those properties that are erroring when you enable verbatimModuleSyntax
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"compilerOptions": {
// workaround for https://github.com/vuejs/tsconfig/issues/6
"preserveValueImports": false,
"importsNotUsedAsValues": "remove",
"verbatimModuleSyntax": true,
// end workaround
},
}
I saw you used @vue/tsconfig/tsconfig.web.json
.
Upvotes: 16
Reputation: 352
According to the verbatimModuleSyntax instead of
"importsNotUsedAsValues": "error"
You should use
"verbatimModuleSyntax": true
See the details in the pull request.
Originally answered here.
Upvotes: 15
Reputation: 277
You can hide this warning by adding the following command in tsconfig.json
of your project:
{
"compilerOptions": {
"ignoreDeprecations": "5.0",
....
}
}
Upvotes: 7