Skip to content

Confusing error message when there is an accidental circular reference in monorepo #61577

@Jack-Works

Description

@Jack-Works

🔎 Search Terms

because it would overwrite input file

🕗 Version & Regression Information

  • This is the behavior in every version (5.8.3 and 5.9.0-dev.20250330) I tried, and I reviewed the FAQ for entries about "because it would overwrite input file"

⏯ Playground Link

https://github.com/Jack-Works/reproduce/tree/main/ts-accidental-circular-reference

💻 Code

git clone https://github.com/Jack-Works/reproduce/ --filter=blob:none
cd ts-accidental-circular-reference
code .
code ./b/src/index.ts
code ./b/tsconfig.json

🙁 Actual behavior

a error message that is not very helpful at b/tsconfig.json.

Cannot write file 'reproduce/ts-accidental-circular-reference/b/dist/index.d.ts' because it would overwrite input file.ts

🙂 Expected behavior

Despite the error message, tsc should give some helpful information so developers can figure out there is a circular project reference between a and b. Without this kind of information, circular reference is extremely hard to find out in a big monorepo

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions