How to force tsc to ignore node_modules folder?

Daniel Santos picture Daniel Santos · Aug 1, 2018 · Viewed 48.2k times · Source

I'm using tsc build tasks. Unfortunately I'm always getting the same errors from the node modules folder

Executing task: .\node_modules\.bin\tsc.cmd --watch -p .\tsconfig.json <
node_modules/@types/node/index.d.ts(6208,55): error TS2304: Cannot find name 'Map'.
node_modules/@types/node/index.d.ts(6215,55): error TS2304: Cannot find name 'Set'.
node_modules/@types/node/index.d.ts(6219,64): error TS2304: Cannot find name 'Symbol'.
node_modules/@types/node/index.d.ts(6225,59): error TS2304: Cannot find name 'WeakMap'.
node_modules/@types/node/index.d.ts(6226,59): error TS2304: Cannot find name 'WeakSet'.
10:13:18 - Compilation complete. Watching for file changes.

I already added the directory to the ignore at tsconfig.json


    {
      "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true,
        "strict": false,
        "noImplicitAny": false,
        "strictPropertyInitialization": false,
        "esModuleInterop": true,
      },
      "include": [
        "src/*"
      ],
      "exclude": [
        "node_modules",
        "./node_modules",
        "./node_modules/*",
        "./node_modules/@types/node/index.d.ts",
      ]
    }

What I'm doing wrong? What should I do in order to ignore those errors?

I'm using VsCode and tsc Version 2.9.2

Answer

Daniel Swiegers picture Daniel Swiegers · Aug 26, 2019

Quickfix is to skip the check

{
  "compilerOptions": {
    "skipLibCheck": true
  },
}