Skip to content

Altering input causes TS5055Β #53315

@remcohaszing

Description

@remcohaszing

Bug Report

πŸ”Ž Search Terms

TS5055

πŸ•— Version & Regression Information

  • This is a crash
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about TS5055
  • I reproduced this using TypeScript 4.4 and TypeScript 5.

⏯ Playground Link

N/A

πŸ’» Code

// tsconfig.json
// Modifying anything, for example editing this comment, will cause the issue.
{
  "compilerOptions": {
    "checkJs": true,
    // This comment just broke some internal state
    "declaration": true,
    "emitDeclarationOnly": true
  }
}
// index.js
// Modifying anything, for example editing this comment, will cause the issue.

πŸ™ Actual behavior

Run the following

$ # Run thow however many times you like
$ tsc --build
$ tsc --build
$ tsc --build
$ tsc --build
$ tsc --build
$ tsc --build
$ tsc --build
$ tsc --build
$ # Can also be reproduced by adding this to tsconfig.json instead.
$ echo '//comment' >> index.js
$ tsc --build
error TS5055: Cannot write file '/home/remco/Downloads/asd/index.d.ts' because it would overwrite input file.


Found 1 error.

Without the --build flag this happens regardless of any previous modifications.

To recover, run:

tsc --build --clean

πŸ™‚ Expected behavior

Consistency. It’s currently not clear if one is supposed to exclude *.d.ts or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions