欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

解决vsc写es7中的Decorator 报错的方法 Experimental support for decorators is a feature that is subject to change in a future release 有大用 有大大用 有大大大用

Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.ts(1219)


解决vsc写es7中的Decorator报错的方法

       
0.168                字数 150阅读 2,449            


下午自己学习了下mobx ,然后接触到了decorator装饰器,接着用visual studio code 写mobx 和 react的代码;写到如下的代码时:

           
image.png

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

编辑器竟然在observer哪里报了个红线的warning,于是我找到了如下的方法解决:
在项目目录下新建tsconfig.json文件,然后加入如下配置就可以完美解决了。

{
    "compilerOptions": {
        "experimentalDecorators": true,
        "allowJs": true
    }
}
   

重新打开vsc编辑器就不会显示那条红线了。

           
image.png


来自   https://www.jianshu.com/p/e62b63f96871

普通分类: