Skip to content

Generated declaration files flip-flop with tsc over @Filename #195

Done

Description

@Shinrai

Repos that commit tsc-generated declarations (types/**/*.d.mts, *.d.ts) end up with fix-headers and tsc rewriting each other.

tsc copies the source file's header into the declaration, so types/src/index.d.mts comes out with @Filename: /src/index.mts. fix-headers then treats it as a normal file and rewrites it to @Filename: /types/src/index.d.mts (plus a new @Last modified time). The next types:build puts /src/index.mts back, and so on. Every run of either tool leaves a diff.

Seen in CLDMV/lib-sqlite-wasm with 2.3.0: a full run touched 32 files under types/ with nothing but this. Worked around there with "excludeFolders": ["types"] in .configs/fix-headers.json (CLDMV/lib-sqlite-wasm@a3d0f34), but every repo with committed types would need the same thing.

Suggested fix: leave a declaration file (.d.ts, .d.mts, .d.cts) alone when its existing header's @Filename names a different file, i.e. it's a copy of a source header that the source run already maintains. Adding types to the excludeFolders default in @cldmv/configs/fix-headers.json would also work, but only for repos that use that folder name.

Activity

  1. added
    type: bug
    priority: medium
    status: confirmed
    area: core
    status: in progress
    and removed
    status: confirmed
    on Nov 25, 2026
  2. added a commit that references this issue on Nov 25, 2026
    19edcaf
  3. added
    status: implemented
    and removed
    status: in progress
    on Nov 25, 2026
  4. cldmv-bot commented on Nov 25, 2026

    @cldmv-bot
    Contributor

    Marked status: implemented — resolved by #196, merged into next. This issue closes automatically when that work ships to the default branch.

  5. added a commit that references this issue on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: corepriority: mediumstatus: implementedtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions