加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular – 实验装饰器警告VSCODE

发布时间:2020-12-17 18:09:48 所属栏目:安全 来源:网络整理
导读:我正在研究Angular2-Typescript应用程序.我用angular-cli生成了如下项目: ng new myApp 但是当我创建一个新组件时,@ Component标签上会出现一个警告. 我试着在这篇文章后解决: Experimental decorators warning in Visual Studio Code 但对我不起作用. 我
我正在研究Angular2-Typescript应用程序.我用angular-cli生成了如下项目:

ng new myApp

但是当我创建一个新组件时,@ Component标签上会出现一个警告.

我试着在这篇文章后解决:

Experimental decorators warning in 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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读