tsc --watch never recompiles on macOS since 7.1.0-dev.20260811.1

未关闭
#64,351 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
go, macos, typescript

调研方向

Start with the provided macOS shell repro using tsc --watch, then compare behavior between the last good and first bad nightly. Inspect the watch-mode changes in the listed regression commits, especially the macOS realpath change, and verify that edits, new files, tsconfig changes, and deletions trigger recompilation with the expected diagnostic.

由索引模型根据 Issue 内容生成。

描述

🔎 Search Terms
  • --watch never recompiles
  • tsc --watch macOS no file change detected
  • --build --watch macOS regression 7.1.0-dev.20260811.1
🕗 Version & Regression Information
  • Broken in every nightly from 7.1.0-dev.20260811.1 through 7.1.0-dev.20260919.1 (@typescript/typescript-darwin-x64)
  • Works in 7.1.0-dev.20260810.1 and in @typescript/native-preview 7.0.0-dev.20260707.2
  • Bisected across the published nightlies: last good 7.1.0-dev.20260810.1 (published 2026-08-10T08:17Z), first bad 7.1.0-dev.20260811.1 (published 2026-08-11T08:18Z)
  • macOS 26.6.2 (x64, APFS); TypeScript 5.9.3 tsc --watch works in the same shell

Commits on main between the two nightly builds:

  • 40af284bf Handle extensionless root files gracefully instead of panicking (microsoft/typescript-go#4628)
  • 5cad7ecba Fall back to inotify when filesystem has errors in fanotify (fix watch in Docker) (microsoft/typescript-go#4661)
  • b7045b4c0 Fix watch diagnostics when global declaration is removed (microsoft/typescript-go#4848)
  • 1adcc6258 Preserve await context for exported classes in nested containers (microsoft/typescript-go#4823)
  • 3c315b7dd Account nested declaration emits as emit time (microsoft/typescript-go#4557)
  • a649b1fd4 Remove macOS realpath fast path (microsoft/typescript-go#4867)
  • bbf7371f5 Port transpileModule, transpileDeclaration (microsoft/typescript-go#4849)
  • 56244ebe9 Split heritage clause expression and type nodes (microsoft/typescript-go#4797)
⏯ Playground Link

n/a (watch mode)

💻 Code
mkdir repro && cd repro
echo '{ "compilerOptions": { "strict": true, "noEmit": true }, "include": ["*.ts"] }' > tsconfig.json
echo 'export const a: number = 1;' > a.ts
tsc --watch --pretty false &
sleep 2
echo 'export const a: number = "x";' > a.ts
sleep 10
🙁 Actual behavior
11:33:16 AM - Starting compilation in watch mode...

11:33:16 AM - Found 0 errors. Watching for file changes.

Nothing else is ever printed. The edited file is not re-checked and TS2322 never appears. A second edit, creating a new b.ts, editing tsconfig.json and deleting a file are all ignored as well. tsc --build --watch behaves the same.

Things that make no difference:

  • --watchFile fixedpollinginterval, dynamicprioritypolling, prioritypollinginterval, usefseventsonparentdirectory (and --watchDirectory fixedpollinginterval): the options are accepted, the behaviour is identical
  • Directory shape: an all-lowercase directory with no symlink in its path (/private/tmp/tsrx-watch-lower), a mixed-case one (/private/tmp/tsrx-Watch-Upper), a path through the /tmp symlink, a path under $HOME, and a firmlink-prefixed path (/System/Volumes/Data/...) all fail the same way
  • stdin: closed (/dev/null) or kept open as a pipe
  • With or without a content mapper in the project

So this looks different from #64089 (dropped FSEvents when casing differs), although the regression window contains the realpath change that issue mentions (a649b1fd4).

On 7.1.0-dev.20260810.1 the same steps print File change detected. Starting incremental compilation... and the TS2322 error about 2 seconds after the edit.

🙂 Expected behavior

Watch mode recompiles after the edit and reports the error, as 7.1.0-dev.20260810.1 and TypeScript 5.9 do.

Additional information about the issue

Only macOS was tested (Intel, macOS 26.6.2). Found while building the .tsrx content mapper for TSRX (tsrx-org/tsrx#41), where the --watch test can only assert the initial compilation.

主要语言
Go
星标
111k
派生
14.4k
平均合并
1 天 15 小时
30 天内合并 PR
106

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/TypeScript 的其他 Issue

查看 microsoft/TypeScript 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。