Repository navigation
Description
🔎 Search Terms
incremental stale diagnostics module augmentation re-export interface tsbuildinfo
🕗 Version & Regression Information
Reproduces on TypeScript 6.0.3, 7.0.2, and 7.1.0-dev.20260922.1 (the next version when tested).
Tested on macOS arm64 with Node 24.14.1 and npm 11.18.0. I reviewed the FAQ and searched existing augmentation and incremental-build reports.
⏯ Playground Link
💻 Code
// src/registry.ts
export interface Registry {}
// src/index.ts
export type { Registry } from "./registry.js"
// src/augment.ts
import "./index.js"
declare module "./index.js" {
interface Registry {
value: number
}
}
// src/consumer.ts
import type { Registry } from "./registry.js"
const value: Registry["value"] = "hello"package.json:
{
"private": true,
"type": "module",
"scripts": {
"check": "tsc"
},
"devDependencies": {
"typescript": "7.0.2"
}
}tsconfig.json:
{
"compilerOptions": {
"incremental": true,
"noEmit": true,
"tsBuildInfoFile": ".cache/tsconfig.tsbuildinfo"
},
"include": ["src"]
}- Run
npm run check. The initial TS2322 error is expected. - Change only
value: numbertovalue: stringinsrc/augment.ts. - Run
npm run checkagain, retaining the build cache. - Delete
.cache/tsconfig.tsbuildinfoand runnpm run checkagain, without changing any source.
🙁 Actual behavior
Step 3 still reports this error in src/consumer.ts:
error TS2322: Type 'string' is not assignable to type 'number'.
Step 4 succeeds. Incremental and clean builds disagree on identical source files.
🙂 Expected behavior
Step 3 should succeed, matching the clean build. The augmentation now declares value: string.
Additional information about the issue
Changing both ./index.js paths in src/augment.ts to ./registry.js avoids the stale error. Defining Registry in src/index.ts and re-exporting it from src/registry.ts also avoids it. Both controls were verified on all three compiler versions above.
Related: #44094, fixed by #45156, concerns missed augmentation updates during incremental compilation. #63960 also involves augmentation through a type-only re-export, but reports a file-order issue.
Activity