atom-typescript: Type errors from lib.*.d.ts not always detected

I’ve got some type errors from lib.*.d.ts files (f.e. lib.dom.d.ts). When I run tsc to typecheck from command line, I get the type errors. However atom-typescript will not show any errors unless I open the lib.*.d.ts file in Atom, at which point atom-typescript will notice and begin showing me the type errors now that I have the lib file.

tsconfig:

{
  "compilerOptions": {
    "target": "es2017",
    "lib": ["es6", "es7", "es2016", "es2017", "dom"],
    "module": "commonjs",
    "moduleResolution": "node",
    "declaration": true,
    "emitDecoratorMetadata": true,
    "jsx": "react",
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitReturns": true,
    "noImplicitAny": false,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "preserveConstEnums": true,
    "pretty": true,
    "strictNullChecks": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "sourceMap": true,
    "outDir": "./dist/out",
    "paths": {
      "*": ["*"]
    },
    "baseUrl": "./src"
  },
  "compileOnSave": true,
  "include": ["src/**/*"]
}

Any ideas why this happens?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17

Most upvoted comments

A couple things to check for:

  • Are your *.d.ts files part of your project (via include or files)? If not, TypeScript won’t check those as part of your project, obviously.
  • Do you have skipLibCheck: true in tsconfig.json? This will prevent TypeScript from checking *.d.ts files
  • Do you expect TypeScript to always check your whole project? This won’t happen for performance reasons. With Atom-Typescript, you can force a complete typecheck of the project by running typescript:check-all-files command (bound to F7 by default) – it might take a while depending on the size of your project and whether you’re using any language service plugins.