下午自己學(xué)習(xí)了下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衰抑,于是我找到了如下的方法解決:
在項(xiàng)目目錄下新建tsconfig.json文件,然后加入如下配置就可以完美解決了香伴。
{
"compilerOptions": {
"experimentalDecorators": true,
"allowJs": true
}
}
重新打開vsc編輯器就不會顯示那條紅線了慰枕。
image.png