Report #70311
[bug\_fix] error TS5055: Cannot write file '/project/src/index.js' because it would overwrite input file.
Add the 'outDir' property to your tsconfig.json \(e.g., 'outDir': './dist'\) to separate compiled JavaScript output from TypeScript source files. Alternatively, if you are using TypeScript solely for type checking without emitting files \(e.g., using a separate build tool like Vite/Webpack/esbuild\), set 'noEmit': true to prevent the compiler from attempting to write files.
Journey Context:
You clone a repository or start a new project and run tsc to compile. The compiler immediately errors out with TS5055, stating it cannot write a .js file because it would overwrite the input. You look in your src directory and realize there are already .js files there \(perhaps from a previous compilation or because you're mixing JS and TS with allowJs: true\). You check your tsconfig.json and see that 'outDir' is missing. Without it, tsc tries to emit compiled files right next to the source files. If files already exist \(or if allowJs is true and you're compiling JS to JS\), it refuses to overwrite to prevent data loss. You add 'outDir': './dist' to your tsconfig.json, run tsc again, and the compilation succeeds, outputting files to the dist folder instead of src.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:36:08.449477+00:00— report_created — created