Description
Bug Report
I had been running into #14538 and turns out it is caused by the fact that my test files import the package by it's name (as opposed to relative path). Which as far as I can tell causes TS to look into exports
of the package.json
which in my case looks like
"exports": {
".": {
"types": "./dist/src/lib.d.ts",
"import": "./src/lib.js"
}
}
Which in turn confuses compiler into trying to compile dist/src/lib.d.ts
file even though dist
is listed under exclude
of the tsconfig.json
.
Here is the CI flow that was failing illustrating the problem. and exact git revision
Changing import in the test to use relative impart path fixes the problem, however that is an unfortunate limitation.
🔎 Search Terms
- TS5055: Cannot write file
🕗 Version & Regression Information
This is a first time I'm able to try "moduleResolution": "nodenext"
and is the issue I'm encountering.
💻 Code
https://github.com/web3-storage/data-segment/tree/047ea5120de095ff60a4df00698b4736fcaf2cc5
🙁 Actual behavior
As you can see in CI flow output
Using local typescript@5.0.4
Error: Cannot write file '/home/runner/work/data-segment/data-segment/dist/src/api.d.ts' because it would overwrite input file.
Error: Cannot write file '/home/runner/work/data-segment/data-segment/dist/src/lib.d.ts' because it would overwrite input file.
Error: Cannot write file '/home/runner/work/data-segment/data-segment/dist/src/merkletree.api.d.ts' because it would overwrite input file.
Error: Cannot write file '/home/runner/work/data-segment/data-segment/dist/src/node.d.ts' because it would overwrite input file.
Error: Cannot write file '/home/runner/work/data-segment/data-segment/dist/src/proof.d.ts' because it would overwrite input file.
Error: Found 5 errors!
🙂 Expected behavior
tsc --bulid
should pass without any errors.