How to Excludes Packages and Typing Files from the TypeScript Compiler

by Michael Szul on

No ads, no tracking, and no data collection. Enjoy this article? Buy us a ☕.

So you're coding away on your new TypeScript project, everything is going great, and you're ready to transpile your code into some JavaScript, and get running. You drop into the command line, build, and you receive an error.

Oh no! But your code was perfect. Wait a minute… that file isn't yours.

As it turns out, the TypeScript compiler is choking on a typing file (a *.d.ts file) that isn't even yours.

Luckily, you can fix this with a simple command line switch:

tsc app.ts --skipLibCheck true

If you're using a tsconfig.json file, you can put this in the compilerOptions property:

          "compilerOptions": {
              "skipLibCheck": true

This will eliminate errors output by externally installed packages.