How to ignore some files when running type checking some files using tsc

Viewed 17455

I would like to ignore some files when type checking some files using tsc and cannot figure out how this is done in TypeScript. Tools like eslint or flow allow special comments in the source files that allow to control the compiler.

1 Answers

In individual files, you can ignore specific lines by adding // @ts-ignore on the preceding line.

more about it here (// ts-ignore does not work with .ts files however as of now)

and exclude files/folders using glob patterns in your tsconfig.json as below as long long as they aren't imported in other files such as in the case of independent unit test files and the like

{
    "exclude": [
        "**/*.spec.ts"
    ]
}

more about that, here

Related