Skip to content

Project references cause TS5055 #29549

Closed as not planned
Closed as not planned
@haggholm

Description

@haggholm

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,

test$ tree
.
├── build
│   └── packages
├── node_modules
│   └── @scope
│       ├── child1 -> ../../packages/child1
│       └── child2 -> ../../packages/child2
├── package.json
├── packages
│   ├── child1
│   │   ├── build
│   │   │   ├── index.d.ts
│   │   │   └── index.js
│   │   ├── package.json
│   │   ├── src
│   │   │   └── index.ts
│   │   └── tsconfig.json
│   └── child2
│       ├── build
│       │   ├── index.d.ts
│       │   ├── index.js
│       │   ├── something.d.ts
│       │   └── something.js
│       ├── package.json
│       ├── src
│       │   ├── index.ts
│       │   └── something.ts
│       └── tsconfig.json
├── tsconfig.json

(https://github.com/haggholm/ts5055)

Because child1 depends on child2 and vice versa, if you run tsc --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 under packages/*/build, since they’re excluded by the respective packages/*/tsconfig.json.

Actual behavior:

Output files of child1 are treated as input files because they are imported by child2. Output files show up in tsc --listFiles.

Related Issues: There are many TS5055-related issues, but I did not find any that are specifically related to project references/tsc --build.

Metadata

Metadata

Assignees

Labels

Needs More InfoThe issue still hasn't been fully clarifiedScenario: Monorepos & Cross-Project ReferencesRelates to composite projects (a.k.a references between "medium sized projects")

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions