Reputation: 119
I'm using TypeScript in VSCode to raise the bar on my JavaScript quality. However, tsconfig.json keeps throwing errors that it cannot write my .js files. Specifically:
"Cannot write file 'lib/chart.js' because it would overwrite input file."
I've seen several similar questions here, but they all simply suggest to exclude the .js files. However, I actually want TypeScript to show me code warnings for those files.
I'm looking for suggestions on how to have TypeScript review my JS files, but not keep throwing errors about not being able to write the input file itself.
Note, that this doesn't happen for all my .js files, just some of them.
Below is my tsconfig.json file. Note that all my .js files are in the lib folder.
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"lib": ["es2018", "dom"]
},
"include": [
"lib"
],
"typeAcquisition": {
"enable": true
}
}
Upvotes: 6
Views: 9281
Reputation: 275947
Cannot write file 'lib/chart.js' because it would overwrite input file."
Use outDir
if you are using allowJs
. TypeScript will take the input .js
files and put a same named one in the outDir
.
Upvotes: 16