title: Typescript - cannot write file because it would override input file
body: <p>For quite a while now I have been getting the error &quot;Cannot write file '...' because it would overwrite input file.&quot; and I can not figure out why this error occurs. The error output is:
  <a href="https://i.stack.imgur.com/wVYJX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wVYJX.png" alt="enter image description here" /></a></p>
  <p>I know there are plenty of questions on StackOverflow about this issue, however none of them seemed to help.</p>
  <p>This is my TSConfig:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;compilerOptions&quot;: {
          &quot;target&quot;: &quot;ES6&quot;,
          &quot;module&quot;: &quot;CommonJS&quot;,
          &quot;lib&quot;: [&quot;ESNext&quot;],
          &quot;outDir&quot;: &quot;dist&quot;,
          &quot;strict&quot;: true,
          &quot;sourceMap&quot;: true,
          &quot;declaration&quot;: true,
          &quot;declarationMap&quot;: true,
          &quot;esModuleInterop&quot;: true,
          &quot;experimentalDecorators&quot;: true,
          &quot;emitDecoratorMetadata&quot;: true,
          &quot;resolveJsonModule&quot;: true,
          &quot;noImplicitOverride&quot;: true
      },
      &quot;include&quot;: [&quot;src/**/*.ts&quot;, &quot;test/**/*.ts&quot;, &quot;index.ts&quot;, &quot;.eslintrc.js&quot;],
      &quot;exclude&quot;: [&quot;coverage&quot;, &quot;dist&quot;, &quot;node_modules&quot;]
  }
  </code></pre>
  <p>As you can see, all files in <code>dist</code> are explicitly excluded. I have also tried adding <code>*.d.ts</code> to the <code>exclude</code> array, but that did not help either (which seems very strange to me).</p>
  <p>I have also verified that this TSConfig file is indeed the one being used by the typescript compiler.</p>
  <p>I am currently using typescript version 4.3.5, but the problem has been present for quite a while now (I can not remember for how long, but already before the switch to TS version 4).</p>
  <p>Also, I have tried re-cloning the repository, moving the directory to another path (because TypeScript might struggle with the directory name <code>config</code>) and naturally also deleting the directory <code>dist</code>. In addition to that, I use the same TSConfig file in plenty of other projects but the problem only exists with this one.</p>