最近一直在VSCode上折腾typescript,遇到一个问题一直解决不了:
Experimental support for decorators is a feature that is subject to change in a future release. Set the ‘experimentalDecorators’ option to remove this warning.
作者:望星star
链接:https://www.jianshu.com/p/fd2f9caa64dd
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
出现这个错误的原因很简单,装饰器的语法是ES7的实验性语法,在VSCode中需要打开experimentalDecorators的设置方可消除报错提示。
解决方法有两个:
1、在tsconfig.json中设置experimentalDecorators为true。
2、在VSCode的settings.json中设置javascript.implicitProjectConfig.experimentalDecorators为true。
重启vscode