Repository navigation
release: v2.5.0 - rewriteDeclarationCopies restamps tsc-copied… - #204
Merged
Merged
Conversation
For packages that build types/ in CI or prepack instead of committing it. With rewriteDeclarationCopies (--rewrite-declaration-copies), a .d.ts / .d.mts / .d.cts carrying tsc's copy of its own source's header is restamped instead of skipped: @filename and @project follow the path and package it ships in (a staged package folder with its own package.json is its own project root), and @Date, @author, @last modified by and @last modified time stay as the source's header has them. Skipping stays the default. Resolves #201
Generated declarations are what an IDE shows, so they get a header for the path and package they ship in by default. rewriteDeclarationCopies: false (--no-rewrite-declaration-copies) skips them, for repos that still commit types/; this repo sets it until its types/ moves out of git. Resolves #201
A gitignored declaration counted as edited on every run, so a second run restamped it with the runner and the current time. A declaration git does not track that already has a header is now treated as generated and keeps the editor and dates it carries.
Generated declarations are what an IDE shows, so a `.d.ts`/`.d.mts`/`.d.cts` carrying `tsc`'s copy of its source's header now gets a header for where it ships: `@Filename: types/src/x.d.mts` and that package's `@Project`. A staged package folder with its own `package.json` is its own root, so `dist-packages/x-types/lib/x.d.mts` gets `@Filename: lib/x.d.mts`. `@Date`, `@Author`, `@Last modified by` and `@Last modified time` are kept from the source's header, and a later run leaves a restamped declaration that git doesn't track as it is, since the generated file has no git history. `rewriteDeclarationCopies: false` (`--no-rewrite-declaration-copies`) keeps the 2.4.0 skip for repos that still commit `types/`. This repo sets it until its own `types/` moves out of git. Resolves #201
Contributor
Author
🔒 Dependency Review
|
Contributor
Author
|
| File | Raw | Δ Raw | Gzipped | Δ Gzipped |
|---|---|---|---|---|
| bin/fix-headers.mjs | 62.9 kB | +739 B (+1.2%) |
21.7 kB | +243 B |
| dist/index.cjs | 1.8 kB | — | 1012 B | — |
| dist/index.mjs | 52.4 kB | +259 B (+0.5%) | 18.4 kB | +125 B |
| Total | 117.1 kB | +998 B | 41.1 kB | +368 B |
📊 Generated by bundle-size. Brotli sizes also measured but omitted from the table for brevity.
Release notes for v2.5.0: `docs/changelog/v2/v2.5.0.md` covering #202, and README What's New promoted to v2.5.0 (v2.4.0 moves into Recent Releases, v2.2.5 drops off).
Shinrai
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@cldmv/fix-headersv2.5.0 ChangelogRelease Date: November 2026
Release Type: Minor
Branch:
release/2.5.0Overview
Generated TypeScript declarations get a header of their own.
tsccopies a source file's header into the.d.ts/.d.mts/.d.ctsit emits, so the declaration an IDE shows named the source file. fix-headers now restamps such a declaration for the path and package it ships in, keeping the source's dates and author. This is the setup for packages that buildtypes/in CI orprepackinstead of committing it.✨ Features
Generated declarations are restamped for where they ship (#202)
A declaration whose header names its own source (
types/src/x.d.mtswith@Filename: src/x.mts) gets@Filename: types/src/x.d.mtsand its package's@Project.@Date,@Author,@Last modified byand@Last modified timestay as the source's header has them, since a generated file has no git history of its own. A staged package folder with its ownpackage.jsonis its own project root, sodist-packages/x-types/lib/x.d.mtsgets@Filename: lib/x.d.mtsand that package's name. Run fix-headers aftertsc, for examplefix-headers --input typesinprepackor CI.A later run leaves a restamped declaration as it is when git doesn't track it: a declaration with a header that git doesn't track is treated as generated, so it keeps the editor and dates it carries instead of taking the runner and the current time.
rewriteDeclarationCopies: false(CLI--no-rewrite-declaration-copies) keeps the 2.4.0 behaviour of skipping these declarations, for repos that still committypes/.Fixes #201.
📚 Documentation
rewriteDeclarationCopiesoption and--rewrite-declaration-copies/--no-rewrite-declaration-copiesflags, and the generated-declaration rule (#202).🔧 Dependencies
No dependency updates.
Upgrade notes
types/: set"rewriteDeclarationCopies": falsein the fix-headers config. Otherwise fix-headers andtscrewrite each other's@Filenameon every build, as before 2.4.0. The better fix is to gitignoretypes/and build it in CI andprepack.👥 Contributors
Avg: 99.6% ·
9f69cbb· Node lts/*Co-authored-by: Shinrai [email protected]