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.
{ "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.
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.
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
{ "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
.tsfiles. 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.tsstays unreported, although uses of the declared names are still checked against it. - Turn it on to silence errors from
node_modulesthat you cannot fix, and to get fastertscruns and editor start-up. - Turn it off in a library you publish, at least in CI. A library's generated
.d.tsfiles are part of its public contract, andskipLibCheck: falsecatches declaration output that does not compile for your users. - A passing build with
skipLibCheckdoes 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
skipDefaultLibCheckoption only skips the built-inlib.*.d.tsfiles and is rarely needed;skipLibCheckcovers it. - It is independent from
typesandlib, which choose which declarations are loaded at all.