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.
{
"pilerOptions": {
"allowJs": true,
"checkJs": true,
"lib": ["es2018", "dom"]
},
"include": [
"lib"
],
"typeAcquisition": {
"enable": true
}
}
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.
{
"pilerOptions": {
"allowJs": true,
"checkJs": true,
"lib": ["es2018", "dom"]
},
"include": [
"lib"
],
"typeAcquisition": {
"enable": true
}
}
Share
Improve this question
edited Apr 2, 2019 at 23:04
Odin Anderson
asked Apr 2, 2019 at 22:45
Odin AndersonOdin Anderson
1191 silver badge9 bronze badges
1 Answer
Reset to default 16Cannot 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
.