[英]ng lint command is suceeds but VS code shows error
我正在使用 tslint 工具我的 angular 項目。
我的 tsconfig.json 文件
{
"compileOnSave": false,
"compilerOptions": {
"downlevelIteration": true,
"importHelpers": true,
"module": "esnext",
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
},
"include": [ "src/main.ts" ]
}
ng lint
命令沒有顯示錯誤,但是 VS 代碼顯示紅色錯誤標記說明
對裝飾器的實驗性支持是一項可能在未來版本中更改的功能。 在“tsconfig”或“jsconfig”中設置“experimentalDecorators”選項以刪除此警告。ts(1219)
(我正在為 mac-os 使用 vs 代碼)
注意:我曾嘗試使用experimentalDecorators:false,但問題仍然存在,我從git 下載的項目之一具有完全相同的tsconfig.json 並且它在相同的vscode 中工作。
誰能指出為什么 vscode 顯示錯誤。
我認為 package.json 中的 typescript 版本比 Visual Studio Code 使用的版本舊。 在 Visual Studio Code 的右下角,單擊 TypeScript 版本和 select 選擇工作區版本的選項。 那么棉絨問題應該 go 消失。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.