2
0

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 3 years have passed since last update.

typescriptでProperty 'includes' does not exist on type 'string[]'.のエラーが出た時の対処法

Posted at

現象

初期設定を簡易的にしたtypescriptのファイルでincludesメソッドを呼び出した時に
Property 'includes' does not exist on type 'string[]'.
とエラーが出て怒られてしまった

解決策

tsconfig.jsonのlibの箇所に何も書かれていなかったので下記のように追記

tsconfig.json

"compilerOptions": {
  //中略
  "lib": [
    "es6",
    "dom",
    "es2017"
  ],  
}

これでコンパイルもできるようになりました。

includesってes2017からだったんですね。。

2
0
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?