最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - TypeScript errors in VSCode: "Cannot write file 'x' because it would overwrite input file.

programmeradmin4浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 16

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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论