You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a number of issues (#29549, #16749, #35082, #35541, probably many others) that all think this error:
error TS5055: Cannot write file '/path/to/file.d.ts' because it would overwrite input file.
is a bug. I was about to open another one.
I believe the fundamental issue here is that most people, myself included, believe this is saying that /path/to/file.d.ts is explicitly being included in the tsconfig, e.g. through some weird combination of includes, rootDir, etc, and we all spend time banging our heads trying to figure out how the config is messed up.
What it's actually saying is that /path/to/file.d.ts is somehow being included either via tsconfig.jsonor an import/require statement in your project. For several of these issues, the reason is because the import was referencing the root project folder, and consequently the build folder. In my specific case, VSCode's auto-import referenced the project name I was currently in for some reason, instead of the relative path to a file.
I'm not quite sure how to re-phrase the error, but adding details such as the ones included in --explainFiles would be a huge help.
error TS5055: Cannot write file '/project/build/file.d.ts' because it would overwrite input file.
Imported via '../../file' from file 'src/index.ts'
In my specific case, --explainFiles didn't even contain the offending file (no idea why), making the problem that much harder to figure out.
🔍 Search Terms
TS5055
✅ Viability Checklist
My suggestion meets these guidelines:
This wouldn't be a breaking change in existing TypeScript/JavaScript code
This wouldn't change the runtime behavior of existing JavaScript code
This could be implemented without emitting different JS based on the types of the expressions
This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
Possibly, but I realized it could also have been a refactor and a file got moved from one repo to another. I honestly don't know why there was one file with import from 'current-project' vs a relative import, but it utterly broke the build 😭
I think your observation is keen. At minimum, a rephrasing would be nice, and if it's possible to reconstruct the "why is this here" information from data we already collect, that'd be cool too
Suggestion
There are a number of issues (#29549, #16749, #35082, #35541, probably many others) that all think this error:
error TS5055: Cannot write file '/path/to/file.d.ts' because it would overwrite input file.
is a bug. I was about to open another one.
I believe the fundamental issue here is that most people, myself included, believe this is saying that
/path/to/file.d.ts
is explicitly being included in thetsconfig
, e.g. through some weird combination ofincludes
,rootDir
, etc, and we all spend time banging our heads trying to figure out how the config is messed up.What it's actually saying is that
/path/to/file.d.ts
is somehow being included either viatsconfig.json
or animport
/require
statement in your project. For several of these issues, the reason is because the import was referencing the root project folder, and consequently thebuild
folder. In my specific case, VSCode's auto-import referenced the project name I was currently in for some reason, instead of the relative path to a file.I'm not quite sure how to re-phrase the error, but adding details such as the ones included in
--explainFiles
would be a huge help.In my specific case,
--explainFiles
didn't even contain the offending file (no idea why), making the problem that much harder to figure out.🔍 Search Terms
TS5055
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
📃 Motivating Example
💻 Use Cases
I believe a clearer error message & details would be very helpful to a lot of people
The text was updated successfully, but these errors were encountered: