折腾:
期间,在代码中加上:
class AppGlobal { @observable curUserInfo = EMPTY_USER_INFO; |
结果出现警告:
[js] Experimental support for decorators is a feature that is subject to change in a future release. Set the ‘experimentalDecorators’ option to remove this warning.
Set the experimentalDecorators option to remove this warning
experimentalDecorators Typescript warning always present · Issue #9335 · Microsoft/TypeScript
<a href="https://github.com/Microsoft/TypeScript/issues/10084"–<experimentalDecorators flag seemingly not accepted from tsconfig.json · Issue #10084 · Microsoft/TypeScript
How to remove experimentalDecorators warning in VSCode
【总结】
VSCode中js中添加@observable的decorator时,会报警告:
[js] Experimental support for decorators is a feature that is subject to change in a future release. Set the ‘experimentalDecorators’ option to remove this warning.
原因是
js中,装饰器时实验性的功能,以后可能会变。所以警告提示你。
想要禁止掉这个警告,可以去加上experimentalDecorators的配置。
具体做法为:
新建一个(typescript的配置文件)
tsconfig.json
内容为:
{ “compilerOptions”: { “experimentalDecorators”: true, “allowJs”: true } } |
即可。
转载请注明:在路上 » 【已解决】VSCode中js中@observable警告:Set the experimentalDecorators option to remove this warning