I think I have a reasonably common project setup. A src
directory that contains all my TypeScript code and a dist
directory which contains the compiles JavaScript. The problem is when I enter a symbol from a different module into my code and VS Code suggests places to import it from it will show both the TypeScript module and the compiled module as options. Often the compiled one shows up first in the list and so I frequently accidentally import from my compiled code.
I've ended up putting a lint rule in place to show an error when I do this but I'd much prefer it if I could tell VS Code to ignore the dist
directory for the purposes of suggesting modules to import. Is there a way to do this?
Adding "exclude" option to your "tsconfig.json" file should fix this issue.
{
"compilerOptions": {
/* Basic Options */
"target": "es5",
"module": "commonjs",
"strict": true,
"outDir": "./dist"
},
"exclude": [
"./dist/"
]
}
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