VSCodeのTSファイルのエラーメッセージを消す
English
[ts] Experimental suport for decorators is a feature that is subject to chang in a future release. Set the 'experimentalDecoratos' option to remove this warning.
Japanese
デコレーターの実験的なサポートは将来のリリースで変更になる可能性がある機能です。'experimentalDecorators' オプションを設定してこの警告を削除します
解決方法
手順
- tsconfig.jsonの
"compilerOptions":{}
以下に"experimentalDecorators": true,
を設定する - tsconfig.jsonの
"include": []
を設定する - VSCodeを再起動(必須ではない)
tsconfig.jsonの設定
下記のように"experimentalDecorators": true,
を設定します。
また、"include": []
の指定はtscondifの設定を反映させたいファイルを指定します。
今回の例はNuxt.jsでTSを使おうとした場合の設定のイメージです。
私はstore以下で今回のエラーが出て"store/**/*.ts",
を追加しました。
※抜粋しています
{
"compilerOptions": {
"allowJs": true,
"experimentalDecorators": true,
},
"include": [
"components/**/*.ts",
"components/**/*.vue",
"layouts/**/*.ts",
"layouts/**/*.vue",
"pages/**/*.ts",
"pages/**/*.vue",
"store/**/*.ts",
]
}
参考
詳しくはこちらのGitHubのIssueの会話をご覧ください
https://github.com/microsoft/TypeScript/issues/9335