2016-11-21 42 views
8

嗨更新到最新的WebStorm,現在我收到此錯誤:WebStorm 2016.3錯誤:裝飾實驗的支持是一個特點,就是在將來的版本中改變

Error:(52, 14) TS1219:Experimental support for decorators 
is a feature that is subject to change in a future release. 
Set the 'experimentalDecorators' option to remove this warning. 

但在我tsConfig experimentalDecorators是設置爲true:

{ 
    "version": "1.5.0", 
    "compilerOptions": { 
    //..., 
    "experimentalDecorators": true, // <======== HERE 
    //..., 
    }, 
    "files": [ 
    //... 
    ], 
    "exclude": [ "node_modules" ] 
} 
+0

您可以嘗試[此答案](http://stackoverflow.com/a/35660772/2435473)? –

+0

您的tsconfig.json不包含項目文件 – anstarovoyt

+0

@ anstarovoyt你是什麼意思? – commonSenseCode

回答

17

WS2016.3適用的配置設置,只有當文件包含在「文件」或「包括」 tsconfig.json部分文件。 [More info about tsconfig.json]

所以配置必須包含所有的項目文件(或者如果你有幾個應用程序的部分,你可以有幾個tsconfig.json文件)。否則,打字稿服務會爲文件使用默認的打字稿選項。

首選解決方案

tsconfig.json應該是:

{ 
    "version": "1.5.0", 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "noImplicitAny": false, 
    "removeComments": true, 
    "noLib": false, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "sourceMap": true, 
    "listFiles": true, 
    "isolatedModules": false, 
    "moduleResolution": "node", 
    "suppressImplicitAnyIndexErrors": true 
    }, 
    "include": [ 
    "typings/thera/thera.d.ts", 
    "typings/browser.d.ts", 
    "typings/main.d.ts", 
    "typings/meteor.d.ts", 
    "typings/meteor_server.d.ts", 
    "your_app_directory/**/*" 
    ], 
    "exclude": [ "node_modules" ], 
    "compileOnSave":false //not required but is suggested for meteor projects 
} 

另一種解決方案

您可以指定在打字稿設置默認選項(track changes選項應該是未選中如果你不想自動編譯):

TypeScript Settings

注:如果你不喜歡新的行爲,您可以禁用「文件打字稿服務集成|設置|語言&框架| TypeScript「 - >」使用TypeScript服務「

+5

或者只是重新啓動IDE – Magicode

相關問題