10
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

デコレーターの実験的なサポートは将来のリリースで変更になる可能性がある機能です。'experimentalDecorators' オプションを設定してこの警告を削除します | の対応

Last updated at Posted at 2020-04-22

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' オプションを設定してこの警告を削除します

解決方法

手順

  1. tsconfig.jsonの"compilerOptions":{}以下に"experimentalDecorators": true,を設定する
  2. tsconfig.jsonの"include": []を設定する
  3. 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

10
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?