Typescript error "Cannot write file ... because it would overwrite input file."

I got the same issue. In my case, it was the result of the option: allowJs: true.

So I basically had to remove that line to get rid of the errors. I do not see it in your code, but perhaps it helps you here.

Good luck!


In my instance, I was using the outDir option but not excluding the destination directory from the inputs:

// Bad
{
    "compileOnSave": true,
    "compilerOptions": {
        "outDir": "./built",
        "allowJs": true,
        "target": "es5",
        "allowUnreachableCode": false,
        "noImplicitReturns": true,
        "noImplicitAny": true,
        "typeRoots": [ "./typings" ],
        "outFile": "./built/combined.js"
    },
    "include": [
        "./**/*"
    ],
    "exclude": [
        "./plugins/**/*",
        "./typings/**/*"
    ]
}

All we have to do is exclude the files in the outDir:

// Good
{
    "compileOnSave": true,
    "compilerOptions": {
        "outDir": "./built",
        "allowJs": true,
        "target": "es5",
        "allowUnreachableCode": false,
        "noImplicitReturns": true,
        "noImplicitAny": true,
        "typeRoots": [ "./typings" ],
        "outFile": "./built/combined.js"
    },
    "include": [
        "./**/*"
    ],
    "exclude": [
        "./plugins/**/*",
        "./typings/**/*",
        "./built/**/*" // This is what fixed it!
    ]
}