VSCode中"experimentalDecorators"设置无效

Vue脚手架选择TypeScript,VSCode打开一直报红,遇到一个问题一直解决不了:

Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

出现这个错误的原因很简单,装饰器的语法是ES7的实验性语法,在VSCode中需要打开experimentalDecorators的设置方可消除报错提示。

解决方法有两个:

1、在tsconfig.json中设置experimentalDecorators为true。

2、在VSCode里搜索experimentalDecorators, settings.json中设置javascript.implicitProjectConfig.experimentalDecorators为true。

这两个操作对我来说好像并没有什么用,

是不是VSCode没有识别到tsconfig.json? 此间无意观察到项目的位置是处在工作区中,就尝试了下 直接open项目,结果真的错误消失了

发布了17 篇原创文章 · 获赞 25 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/tanglitong/article/details/84526182