You may be able to use the include
and exclude
properties in your tsconfig.json for more fine-grained control over what files the TypeScript compiler includes:
http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
The "include"
and "exclude"
properties take a list of glob-like file patterns. The supported glob wildcards are:
- * matches zero or more characters (excluding directory separators)
- ? matches any one character (excluding directory separators)
- **/ recursively matches any subdirectory
So perhaps you could do something like:
{
...
"exclude": [
"node_modules"
]
}
Or, depending on yours needs, you could design a more targeted glob pattern that only excludes the node_modules
directory of the one dependency giving you problems.
If you have control over the local-dependency
module in your example, a better solution would be to update either the dependency or your app to use the same the version of the @types/react
module, delete your npm modules, and do a fresh npm install
. This should allow npm to install a single, shared version of the module, removing any possibility for conflicts.
./node_modules/@types/*
in thepaths
key of mytsconfig.json
. – Cottier