11

There are several github issues about why errors in node_modules are thrown although that folder is excluded in tsconfig.json. If there is any import on the lib it is included, ignoring the exclude property.

However when using stricter compiler options (i.e. strictNullChecks, noUnusedLocals, ...) and reference any lib that is not designed to work on those options, errors are thrown.

Thus whenever using such a lib it is always a decision of not using the lib or not using the compiler option. However there are big libraries/frameworks that do not support those options (i.e. Angular) so it seems like there is no way of using those options to ensure strict checks in the own project.

Am I missing some possibility to avoid errors in node_modules being thrown? If not, is there any technical requirement to apply those rules to all imported libraries or what is the reasoning behind this behaviour?

0

1 Answer 1

1

In all my projects setup I have structure where in root I have:

Folders:

  • code_folder
  • node_modules

Files:

  • package.json
  • README.md
  • tsconfig.json
  • tslint.json
  • yarn.lock

Then in tsconfig.json:

{
    "compilerOptions": {
        "lib": ["es6"]
    },
    "include": [
        "code_folder/*"
    ]
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.