'vscode intellisense - cannot find module ts(2307) in excluded directory
In my tsconfig.json I excluded folder
"src/__test__"
from compilation. The problem is now VS Code cannot find module. I run tests with Jest without problem, the modules are resolved but this message is annoying. I also cannot use autocomplete. Is there a way to create seperate typescript config files for tests and source code? So far I created tsconfig.test.json file with "extend": "../../tsconfig.json" but it doesn't work as I expected. Compiler read only base tsconfig.json.
Cannot find module <..> or its corresponding type declarations.ts(2307)
tsconfig.json
{
"compilerOptions": {
"module": "esnext",
"esModuleInterop": true,
"target": "es5",
"lib": ["es6", "dom"],
"sourceMap": false,
"allowJs": true,
"jsx": "react",
"moduleResolution": "node",
"rootDir": "",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"baseUrl": ".",
"outDir": "dist",
"resolveJsonModule": true,
"paths": {
"components/*": ["src/components/*"],
"utils/*": ["src/utils/*"],
"api/*": ["src/api/*"],
"src/*": ["src/*"]
}
},
"exclude": ["src/__tests__"]
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
