-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Project references cause TS5055 #29549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I haven't got a minimal reproduction of my own - but I have noticed this seems to stop happening after a |
I'm not clear what the bug here is supposed to be - are you just missing |
FWIW I just hit this b/c a file accidentally added an import to the
Instead of:
This got |
I have the same problem and can't understand how this should work at all: This whole thing (project references) is barely workable, doesn't make any sense or I missed something. |
This happened in a project I'm working on because I set up a monorepo. The comments were helpful here in unpacking it, so thank you all for that, but it was a head-scratcher for sure. more details about the monorepo-specific situation, skip if you already grok the issueI have a package in my workspace setup at The base class, for purposes of overly convoluted plugin reasons, does When they were separate packages that I was hand-crafting by means of The solution that I'm using: Put this in
(The double-build isn't new, that's the hybrid-module setup, to build esm into one folder and cjs into another.) Then, in both tsconfig files, I changed this: {
"outdir": "dist/esm" // or "dist/cjs"
} to this: {
"outdir": "dist-tmp/esm" // or "dist-tmp.cjs"
} And in #!/usr/bin/env bash
rm -rf dist # remove the previous build
mv dist-tmp dist # put the new build in place Because the Interestingly, this only happened when running |
TypeScript Version: 3.2.4, 3.3.0-rc
Search Terms: TS5055, overwrite input file
Code
Unfortunately, I have thus far been unable to reproduce the exact issue in a minimal scenario; the following is code where I tried to reproduce it. I have only seen it (but frequently) in a more complicated, and proprietary, source tree. What I am thus far able to do is show that the output files show up where they shouldn’t.
The problem: When I have a parent project with child references, some of which children are interdependent, the output files of one package become input files for another package, and both are treated as input files by
tsc
, even though they are listed as output files in the package that owns them. For example,(https://github.com/haggholm/ts5055)
Because
child1
depends onchild2
and vice versa, if you runtsc --listFiles
from the parent directory, the output files are listed. Because they are treated as input files,tsc
refuses to overwrite them.Perhaps
tsc --build
should determine input/output files on a more strictly per-project basis?Expected behavior:
Updating files in one package should obey the input/output rule of that package’s
tsconfig
.tsc --listFiles
should not list anything underpackages/*/build
, since they’re excluded by the respectivepackages/*/tsconfig.json
.Actual behavior:
Output files of
child1
are treated as input files because they are imported bychild2
. Output files show up intsc --listFiles
.Related Issues: There are many TS5055-related issues, but I did not find any that are specifically related to project references/
tsc --build
.The text was updated successfully, but these errors were encountered: