Search code examples
typescript

tsc does not ignore node_modules files


My compiler options are:

{
    "compilerOptions": {
      "outDir": "./dist",
      "allowJs": true,
      "target": "es6",
      "esModuleInterop": true,
      "skipLibCheck": true,
      "types": []
    },
    "include": ["src/**/*"],
    "exclude": ["node_modules"]
  }

and yet, tsc complains about wrong types in files in the node_modules folder, and also:

src/index.ts:125:21 - error TS2802: Type 'IterableIterator<number>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.

even though my target is set to es6.

What am I doing wrong?


Solution

  • If you run tsc [filename], tsconfig.json will be ignored. To solve, simply run tsc by itself.