Reputation: 3673
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?
Upvotes: 11
Views: 999
Reputation: 4119
In all my projects setup I have structure where in root I have:
Folders:
Files:
Then in tsconfig.json:
{
"compilerOptions": {
"lib": ["es6"]
},
"include": [
"code_folder/*"
]
}
Upvotes: 1