Incremental builds miss diagnostics after UMD declaration changes
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 1-2 天
- 新手友好度
- 44/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- go, typescript
- 领域
- build-system, testing
调研方向
Start with fileAffectsGlobalScope and the bound GlobalExports check described in the issue, then inspect the proposed fix in PR #64966. Reproduce the stale diagnostic with the four listed files and consecutive tsgo -p . --noLib --pretty false runs; compare with --incremental false. Done means the incremental build reports TS2322 after the declaration changes, with the CLI/watch tests and baselines passing.
由索引模型根据 Issue 内容生成。
描述
🔎 Search Terms
UMD, export as namespace, incremental, stale diagnostics, affectsGlobalScope
🕗 Version & Regression Information
Reproduced with the Go compiler reporting 7.1.0-beta, built from microsoft/TypeScript commit 3e9236361fa97a9e6c685f4833ac457ae2d8c50a.
The first affected version has not been identified. The latest nightly has not been tested.
⏯ Playground Link
This requires consecutive compiler invocations that reuse .tsbuildinfo; a single Playground compilation does not reproduce it.
💻 Code
Create these four files in a new directory. The minimal library keeps the reproduction independent of installed standard-library files.
tsconfig.json:
{
"compilerOptions": {
"strict": true,
"incremental": true,
"noEmit": true,
"types": []
},
"include": ["*.ts"]
}
lib.d.ts:
interface Array<T> {}
interface Boolean {}
interface CallableFunction {}
interface Function {}
interface IArguments {}
interface NewableFunction {}
interface Number {}
interface Object {}
interface RegExp {}
interface String {}
umd.d.ts:
export as namespace UmdApi;
export interface Item { value: number }
client.ts:
declare const item: UmdApi.Item;
const checked: number = item.value;
-
Run the Go compiler from this directory, using an unpatched
tsgobinary:tsgo -p . --noLib --pretty falseThis succeeds and creates
tsconfig.tsbuildinfo. -
Change only
umd.d.tsto:export as namespace UmdApi; export interface Item { value: string } -
Repeat the same command, keeping the build-info file:
tsgo -p . --noLib --pretty false -
Compare with a compilation that disables incremental reuse:
tsgo -p . --noLib --pretty false --incremental false
🙁 Actual behavior
The second incremental build produces no diagnostics and exits with code 0, even though item.value is now a string and checked requires a number. client.ts has not changed.
Compiling the same files with --incremental false reports the error and exits with code 2:
client.ts(2,7): error TS2322: Type 'string' is not assignable to type 'number'.
A fresh directory containing the same edited inputs, without build-info, produces the same error.
🙂 Expected behavior
The incremental build should report TS2322, matching a fresh compilation of the same inputs.
Additional information about the issue
Proposed fix: https://github.com/microsoft/TypeScript/pull/64966
fileAffectsGlobalScope treats this declaration file as an external module without accounting for the global namespace introduced by export as namespace. As a result, changes to the declaration can leave cached diagnostics for unchanged global consumers intact. The proposed fix checks bound GlobalExports before the external-module early return.
The CLI reproduction above has been verified on the unpatched compiler. The PR's new CLI/watch framework tests and baselines remain pending; they have not been run successfully because required test dependencies are unavailable offline.
- 主要语言
- Go
- 星标
- 112k
- 派生
- 15.4k
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 126
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/TypeScript 的其他 Issue
-
Won't Fix
难度 2/5 1-3 小时 新手友好度 62/100
microsoft/TypeScript#65107 · 1 条评论 ·
维护者通常 1 天内回复
-
Native API: formatDiagnosticsWithColorAndContext drops related information without a file location可能已有人在做 @timurzvural 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
microsoft/TypeScript#65087 ·
维护者通常 1 天内回复
-
TS7 LSP: documentHighlight returns nothing when the file path contains '@'可能重新可做 关联的 PR 已关闭且未合并。 未关闭Bug
难度 2/5 1-3 小时 新手友好度 78/100
microsoft/TypeScript#64758 ·
维护者通常 1 天内回复
-
Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`可能已有人在做 @rajnish-verma-22172 于 13 天前认领。 未关闭Bug
难度 2/5 1-3 小时 新手友好度 76/100
microsoft/TypeScript#64742 · 1 条评论 ·
维护者通常 1 天内回复
-
Class names `eval` and `arguments` are not reported as invalid strict mode bindings可能已有人在做 @dmety 于 26 天前认领。 未关闭Bug
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/TypeScript#64661 ·
维护者通常 1 天内回复
查看 microsoft/TypeScript 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
agent-butler-finding chore
难度 1/5 1 小时以内 新手友好度 78/100
jordansmall/spindrift#6318 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
Eyevinn/moqlivemock#166 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
JakeChampion/lang#14091 ·
维护者通常 1 天内回复
-
batcher: BAF send context leaks per batch可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
hyperledger/fabric-x-orderer#1409 ·
维护者通常 3 天内回复