question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: error TS5055: Cannot write file '...' because it would overwrite input file.

See original GitHub issue

Search terms

> typechecker@7.17.0 our:meta:docs:typedoc
> rm -Rf ./docs && typedoc --exclude '**/+(*test*|node_modules)' --excludeExternals --out ./docs ./source

Error: error TS5055: Cannot write file '/Users/balupton/Projects/auto-fixes/typechecker/test-fixtures/async.js' because it would overwrite input file.

Error: error TS5055: Cannot write file '/Users/balupton/Projects/auto-fixes/typechecker/test-fixtures/classes-compiled.js' because it would overwrite input file.

Error: error TS5055: Cannot write file '/Users/balupton/Projects/auto-fixes/typechecker/test-fixtures/classes.js' because it would overwrite input file.

Error: error TS5055: Cannot write file '/Users/balupton/Projects/auto-fixes/typechecker/test-fixtures/index.js' because it would overwrite input file.

Error: error TS5055: Cannot write file '/Users/balupton/Projects/auto-fixes/typechecker/test-fixtures/map-empty.js' because it would overwrite input file.

Error: error TS5055: Cannot write file '/Users/balupton/Projects/auto-fixes/typechecker/test-fixtures/map.js' because it would overwrite input file.

Error: error TS5055: Cannot write file '/Users/balupton/Projects/auto-fixes/typechecker/test-fixtures/weakmap-empty.js' because it would overwrite input file.

Error: error TS5055: Cannot write file '/Users/balupton/Projects/auto-fixes/typechecker/test-fixtures/weakmap.js' because it would overwrite input file.

Expected Behavior

those files to be ignored due to the --exclude pattern

Actual Behavior

didn’t work

Steps to reproduce the bug

git clone https://github.com/bevry/typechecker.git
cd typechecker
npm install
npm run our:release:prepare

Environment

  • Typedoc version: 0.21.4
  • TypeScript version: 4.3.5
  • Node.js version: 16.5.0
  • OS: Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:27 PDT 2021; root:xnu-7195.141.2~5/RELEASE_ARM64_T8101 x86_64 - m1 mac mini 11.5.1 (20G80)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
Gerrit0commented, Jul 31, 2021

TypeDoc’s behavior matches the behavior of npx tsc, which is expected.

Running npx tsc --explainFiles shows that your include pattern of “source” means that “source/test.ts” is included in the program, which means that all the files in test-fixtures are also included. If you change the include pattern to only include source/index.ts, TypeScript (and therefore TypeDoc) won’t look at your test-fixtures directory.

Alternatively, set a output directory with "outDir": "dist" in your tsconfig and TypeScript will no longer have this error since it won’t be trying to write JS files into the same directory they were discovered from.

1reaction
baluptoncommented, Jul 29, 2021

Solved by adding "exclude": ["test-fixtures", "node_modules", "source/test.ts"] to tsconfig, and // @ts-ignore to the fixture files

Read more comments on GitHub >

github_iconTop Results From Across the Web

visual studio - Typescript error "Cannot write file ... because it ...
Cannot write file 'C:/{{my-project}}/node_modules/buffer-shims/index.js' because it would overwrite input file. It looks like this all the time.
Read more >
Cannot write file because it would overwrite input file TS
The error "Cannot write file because it would overwrite input file" occurs when we haven't specified the outDir directory in the exclude array...
Read more >
Error "Cannot write file ... because it would overwrite input file."
This happens when the declaration files are not excluded from the build. Whenever this occurs, the builder tries to build the existing ".d.ts" ......
Read more >
TypeScript: cannot write file .d.ts because it would overwrite ...
The reason you have this error in the first place is likely because you're writing actual JavaScript and generating types from JSDoc. One...
Read more >
Error “Cannot write file … because it would overwrite input file.”
In this post am going to share with you the irritating typescript warnings and how it was solved for me. Below is the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found