LoginSignup
3
1

More than 5 years have passed since last update.

tsで[Array.includesが存在しません]のエラーが出る

Posted at

こう型を定義していて、

  public sizes: string[];

こうかくと

this.sizes.includes('35')

エラーが出る

error TS2339: Property 'includes' does not exist on type 'string[]'.

対処方法
https://github.com/Microsoft/TypeScript/issues/2340

tsconfig.jsonのlibを以下のようにすれば直った。

    "lib": [
      "dom",
      "es7"
    ],
3
1
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
3
1