How to fix custom type definitions not being type checked

Photo by Cookie the Pom on Unsplash

If you have a custom types file (e.g. myTypes.d.ts) but you get no errors from the type checker and compiler in typescript even though you know there are issues in the file you might have skipLibCheck turned on.

To fix this issue and have typescript check custom type files for errors simply set

{
  "skipLibCheck": true
}

in your tsconfig.json

SkipLibCheck option

"This can save time during compilation at the expense of type-system accuracy. "

It causes typescript to ignore .d.ts files in certain scenarios. If you want all of your .d.ts files to be type checked you should turn off this option.

Read more about it here: https://www.typescriptlang.org/tsconfig#skipLibCheck