Skip to content

Fix issue #3014 #3179

Open
JaskiratAnand wants to merge 1 commit intomicrosoft:mainfrom
JaskiratAnand:fix/tsconfig-no-files
Open

Fix issue #3014 #3179
JaskiratAnand wants to merge 1 commit intomicrosoft:mainfrom
JaskiratAnand:fix/tsconfig-no-files

Conversation

@JaskiratAnand
Copy link

Problem
When running tsgo --watch with a tsconfig.json containing an empty files array and no include rules, the compiler hung silently instead of reporting TS18002 ("The 'files' list in config file... is empty").
This happened because the watcher polling loop (internal/execute/watcher.go) only triggered a build when hasBeenModified was true. On the first cycle, prevModified was empty, so no files appeared modified — skipping the initial build entirely and swallowing the diagnostic.

Solution
Treat the first execution cycle (w.prevModified == nil) as a modified event, ensuring the initial build always runs and configuration diagnostics are emitted correctly.

Changes

  • internal/execute/watcher.go — force initial build on first cycle
  • Added regression test: watch with empty files list in tsconfig

Verification

  • Matches tsc behavior in watch mode (which correctly reports the diagnostic)
  • New regression test passes with committed baseline
  • npx hereby test passes

Fixes #3014

@JaskiratAnand
Copy link
Author

@microsoft-github-policy-service agree

* Fixes a bug in the Go watcher where an initial build was skipped if no files were initially modified, causing a hang when the configuration resulted in an empty source file list (missing diagnostic TS18002).
* Added regression test for empty files list in watch mode.
@JaskiratAnand JaskiratAnand force-pushed the fix/tsconfig-no-files branch from 2fd496c to 9cab0cc Compare March 20, 2026 21:05
@JaskiratAnand JaskiratAnand deleted the fix/tsconfig-no-files branch March 20, 2026 21:12
@JaskiratAnand JaskiratAnand restored the fix/tsconfig-no-files branch March 20, 2026 21:12
@JaskiratAnand JaskiratAnand reopened this Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tsgo --watch hangs if given a tsconfig.json with no files

1 participant