Skip to content
Tutorials Center
My learning

Topics

TypeScript Reference ยท tsconfig: Type Checking Options

TypeScript skipLibCheck option

Reference for the skipLibCheck compiler option: it skips type checking of .d.ts files only, speeds up builds and hides conflicts between packages.

skipLibCheck tells the compiler not to type-check declaration files (.d.ts). Your own .ts and .tsx files are still checked in full, and the types exported by declaration files are still used when you call into them. Only the internal consistency of the .d.ts files themselves is skipped.

Large dependency trees ship hundreds of declaration files. Checking them costs time, and two packages that disagree about a shared type (for example two copies of @types/node) can produce errors you cannot fix because the code is not yours. Most application projects therefore set this option to true; tsc --init generates it that way.

JSON
{
  "compilerOptions": {
    "skipLibCheck": true
  }
}

Try it

The option is a project setting, so it cannot be switched on from a single file. These examples show what stays checked either way.

TypeScript Your own files are always checked

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.

TypeScript Ambient declarations still work

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.

Syntax

JSON
{ "compilerOptions": { "skipLibCheck": true } }
Part Description
Type boolean. Default: false (checking of .d.ts files is on).
Command line tsc --skipLibCheck
Scope Every file whose name ends in .d.ts, .d.mts or .d.cts, from node_modules and from your own project.

Usage notes

  • It does not skip .ts files. The first example above fails with an error on the duplicate property whether or not the option is set.
  • It also affects declaration files you write yourself. A mistake inside your own .d.ts stays unreported, although uses of the declared names are still checked against it.
  • Turn it on to silence errors from node_modules that you cannot fix, and to get faster tsc runs and editor start-up.
  • Turn it off in a library you publish, at least in CI. A library's generated .d.ts files are part of its public contract, and skipLibCheck: false catches declaration output that does not compile for your users.
  • A passing build with skipLibCheck does not prove your dependencies' types are consistent. When a type from a package behaves strangely, try disabling the option once to see the underlying conflict.
  • The related skipDefaultLibCheck option only skips the built-in lib.*.d.ts files and is rarely needed; skipLibCheck covers it.
  • It is independent from types and lib, which choose which declarations are loaded at all.