Skip to content

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

Closed

Description

@leonidaz

🔎 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:

⏯ 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 (a649b1f).

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.

Activity

  1. jakebailey commented on Sep 22, 2026

    @jakebailey
    Member

    Can you try #64210 just to see?

  2. leonidaz commented on Sep 22, 2026

    @leonidaz
    Author

    Jake Bailey (@jakebailey) Ok, tried it out and it works with #64210

    Including a report below on the run, might be helpful.

    TypeScript PR #64210 watch verification

    Date: 2026-09-22. Tested locally on macOS 26.6.2 (25G83), Intel x86_64, APFS, MacBookPro16,1; Node v24.18.0.

    PR #64210 fixes the observed watch regression for this TSRX branch in the exercised scenarios. All 44 edit checks passed, across plain TypeScript and the current TSRX content mapper, in both --watch and --build --watch.

    Exact sources

    Both source builds use Go 1.27.1, CGO_ENABLED=0, and the build command below, matching Herebyfile.mjs. Each build uses its own source library declaration files. Go build metadata verifies the PR revision and vcs.modified=false.

    # From each TypeScript checkout's tsc/ directory:
    CGO_ENABLED=0 /private/tmp/tsrx-pr64210-aujbxqwo/go/bin/go build -tags=noembed -o ../built/local/tsc ./cmd/tsc
    # Copy tsc/internal/bundled/libs/* alongside built/local/tsc.

    Results

    Compiler Plain .ts watch Plain .ts build/watch TSRX watch TSRX build/watch
    Pinned 7.1.0-dev.20260918.1 No recompilation after edit No recompilation after edit No recompilation after edit No recompilation after edit
    Upstream base 1ac2d5a No recompilation after edit No recompilation after edit No recompilation after edit No recompilation after edit
    PR #64210 90385b5 PASS PASS PASS PASS
    Classic TypeScript 5.9.3 (control) PASS PASS Not run Not run

    The upstream base built from source also failed all four scenarios, with no output after the first source edit. This isolates the successful behavior to the PR changes rather than unrelated upstream changes or the local toolchain.

    The pinned nightly completed each initial compilation with zero errors but never reported a file change or TS2322 after the first source edit, with a 15-second wait. Classic TypeScript 5.9.3 passed all 16 plain TypeScript edit checks in the same harness/environment.

    The PR passed 8 edits per plain TypeScript scenario and 14 edits per TSRX scenario (44 total). Detection plus completed diagnostics for TSRX edits ranged from 50–403 ms in the confirmed run; this is a smoke-test observation, not a benchmark.

    What the live edits exercised

    Plain TypeScript, in both modes:

    • Add and fix a TS2322 error in an existing source.
    • Add and delete an included source containing a type error.
    • Introduce a strict-null error, change strict in tsconfig to clear it, restore strict to report it again, then fix the source.

    TSRX, in both modes:

    • Add and fix TS2322 in Button.tsrx.
    • Add and fix TS2322 inside the <script> body in Panel.tsrx.
    • Change an exported prop type in Panel.tsrx; confirm a dependent main.ts diagnostic appears and clears when restored.
    • Introduce a TSRX syntax error; confirm tsrx1000, then recover to zero errors.
    • Add/delete an included .tsrx file; confirm its error appears/clears.
    • Rename/restore an imported .tsrx file; confirm TS2307 appears/clears.
    • Change/restore tsrx.compiler in an extended config; confirm mapper errors (tsrx1002) appear/clear.

    Fixtures are generated with the branch's consumer_fixture_files() and create_native_workspace(). The mapper is launched from the branch's packages/content-mapper/src/server.js, with the workspace target compiler and React types. No published or stale mapper bundle is substituted. Watch uses actual disk changes and native filesystem notifications, with stdin closed. The watch/build fixture is a single project; project-reference behavior is covered by the existing one-shot build tests, not a live multi-project watch test.

    Existing branch tests

    The following passed with the PR binary: 3 test files, 12 tests.

    TSRX_NATIVE_TSC=/private/tmp/tsrx-pr64210-aujbxqwo/typescript/built/local/tsc \
      pnpm test --project content-mapper \
      packages/content-mapper/tests/native-tsc.test.js \
      packages/content-mapper/tests/native-build.test.js \
      packages/content-mapper/tests/native-watch.test.js

    The existing native-watch.test.js asserts only initial compilation, so the separate live-edit probe supplies the regression verification.

    Reproduce and inspect

    node /private/tmp/tsrx-pr64210-aujbxqwo/watch-probe.mjs \
      pr64210-confirmed \
      /private/tmp/tsrx-pr64210-aujbxqwo/typescript/built/local/tsc \
      /private/tmp/tsrx-pr64210-aujbxqwo/results

    The first PR run had one false failure in the plain build/watch probe: duplicate compilations left a prior error in the accumulated output even after later cycles reported zero errors. The probe was corrected to evaluate individual completed compilation cycles, and all four PR scenarios passed in a fresh run (pr64210-confirmed). The initial raw run is retained for transparency.

    TSRX tracked files, dependency pins, and lockfile were not changed. No GitHub comment was posted. Test fixture directories were removed and spawned watch processes stopped; builds, probe, and logs remain in this temporary directory. Results apply to this macOS x64 environment and the exact revisions above.

  3. jakebailey commented on Sep 22, 2026

    @jakebailey
    Member

    Thanks. I'm scoping #64210 specifically down to the other issue, but I should be able to send a different Pr to fix this one.

  4. leonidaz commented on Sep 30, 2026

    @leonidaz
    Author

    Confirmed fixed by #64210, thanks Jake Bailey (@jakebailey).

    On macOS (x64), a plain .ts project with tsc --watch (no content mapper) now recompiles after an edit:

    Nightly After editing an imported file
    7.1.0-dev.20260922.1 no recompilation
    7.1.0-dev.20260923.1 recompiles
    7.1.0-dev.20260930.4 recompiles

    It also recompiles with our content mapper on both fixed builds, for edits to the mapped file and to the .ts importer. Closing.

  5. jakebailey commented on Sep 30, 2026

    @jakebailey
    Member

    Oh, what? That PR was enough?

  6. leonidaz commented on Sep 30, 2026

    @leonidaz
    Author

    I mean, we tried out the latest nightlies and saw both of your pr's merged and it's working now. 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions