簡體   English   中英

實驗裝飾者警告VSCODE

[英]Experimental decorators warning VSCODE

我正在研究Angular2-Typescript應用程序。 我用angular-cli生成了如下項目:

ng new myApp

但是當我創建一個新組件時,@ Component標簽上會出現一個警告。

我試着在這篇文章后解決:

Visual Studio Code中的實驗裝飾器警告

但對我不起作用。

我附上我的tsconfig.json:

{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es6",
"typeRoots": [
  "../node_modules/@types"
  ]
 }
}

打字稿版本是:“打字稿”:“2.0.2”

最后,我解決了我的問題如下:

首先,更新打字稿版本:

$ npm install typescript@next

然后,在vscode中編輯用戶首選項,添加以下內容:

{
  "typescript.tsdk": "node_modules/typescript/lib"
}

感謝peeskillet :)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM