The problem: When type checking my app using tsc I am getting errors for npm linked modules.
Here is my type-check command:
"type-check": "tsc --noEmit -p tsconfig.json"
and here is my tsconfig.json:
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": false,
"allowJs": true,
"module": "commonjs",
"target": "es6",
"jsx": "react",
"esModuleInterop": true,
"experimentalDecorators": true,
"skipLibCheck": true
//"importsNotUsedAsValues": "error"
},
"exclude": ["./node_modules/*"] // I've also tried node_modules, /node_modules, node_modules/
}
The command will fail due to type errors in one of my node_modules which is connected via npm link.
Any way to exclude this module from type check
Edit:
I have also tried using a double globstar (**) e.g.
"exclude": ["./node_modules/**/*"]
and this gives me the same incorrect result.
If you are using webpack try to add symlinks: false in resolve. That solved similar issue for me.
resolve: {
// ...
symlinks: false,
},
If you are using purely tsc try (I haven't tried this):
preserveSymlinks: true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With