You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Declarations tsc emits without the header get build-time dates #214
area: coreTouches core library / runtime source codepriority: lowMinor issue or improvement that can be deferred without impactstatus: implementedBuilt and deployed, but not yet fully tested/verifiedtype: bugSomething is broken or not behaving as expected
tsc only copies a source's header into the declaration when it can keep the comment. When the header is followed by import lines, tsc moves the imports below the declarations and drops the header with them. In this repo that's 35 of the 38 files under types/src/; only files with no imports, such as utils/text.d.mts, keep the copy.
fix-headers then sees a headerless file and stamps it as new: @Date from the file's creation time and @Last modified time = now. Every types:build writes new times, so declarations built in CI or at prepack show the build time instead of the source's dates. The restamp from #201/#202 only covers declarations that still carry the source's header.
Expected: a headerless declaration whose source can be found takes that source's header dates and editor, the same as a copied one. Under the usual outDir layout types/src/x.d.mts comes from src/x.mjs (.d.ts ← .ts .tsx .js .jsx, .d.cts ← .cts .cjs). How fix-headers finds the source (a path rule, or reading rootDir/outDir from a tsconfig) needs deciding.
Repro: on next after #211, run npm run types:build twice; every declaration with imports changes only in @Last modified time.
Find a declaration's source from the tsconfig it was built with: rootDir, outDir and declarationDir if set, following extends. types/src/x.d.mts maps back to <rootDir>/src/x.mts (or the .mjs / .ts sibling), so any layout works, not just a fixed path rule. A tsconfig option points at the file, defaulting to .configs/tsconfig.json and then ./tsconfig.json.
@Filename stays the declaration that ships (types/src/x.d.mts), never the source path. The source is only used to recover @Date, @Author and the rest of the original header when tsc dropped it, so the declaration isn't stamped as new with the build time.
area: coreTouches core library / runtime source codepriority: lowMinor issue or improvement that can be deferred without impactstatus: implementedBuilt and deployed, but not yet fully tested/verifiedtype: bugSomething is broken or not behaving as expected
Activity
Shinrai commentedon Nov 27, 2026
Decision:
rootDir,outDiranddeclarationDirif set, followingextends.types/src/x.d.mtsmaps back to<rootDir>/src/x.mts(or the.mjs/.tssibling), so any layout works, not just a fixed path rule. Atsconfigoption points at the file, defaulting to.configs/tsconfig.jsonand then./tsconfig.json.@Filenamestays the declaration that ships (types/src/x.d.mts), never the source path. The source is only used to recover@Date,@Authorand the rest of the original header whentscdropped it, so the declaration isn't stamped as new with the build time.Doing it as its own PR after #215 merges.
docs: add #214 to the v2.6.0 changelog
feat: find a headerless declaration's source through the tsconfig (#218)
cldmv-bot commentedon Nov 27, 2026
Marked
status: implemented— resolved by #218, merged intonext. This issue closes automatically when that work ships to the default branch.release: v2.6.0 - adopt the generic CJS shim