[api] Report project reference diagnostics on programs without a config file - #64637
Open
Christopher Plieger (cplieger) wants to merge 1 commit into
Open
Christopher Plieger (cplieger) wants to merge 1 commit into
Christopher Plieger (cplieger) wants to merge 1 commit into
Conversation
Copilot started reviewing on behalf of
Christopher Plieger (cplieger)
October 5, 2026 10:29
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused fix correctly uses the existing compiler-diagnostic fallback and includes regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents API crashes when synthetic programs without config files report project-reference diagnostics.
Changes:
- Adds a nil guard before accessing
ConfigFile. - Adds regression coverage for TS6306 reporting.
| File | Description |
|---|---|
tsc/internal/tsoptions/tsconfigparsing.go |
Falls back when reference syntax is unavailable. |
tsc/internal/api/session_createprogram_test.go |
Verifies non-composite reference diagnostics. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backlogmilestone (required)mainbranchnpx hereby testnpx hereby lintnpx hereby check:formatFixes #64629
A program created through
createProgramshas no configuration file, so itsParsedCommandLine.ConfigFileis nil. Any project reference diagnostic on such a program crashes the API server with a nil pointer dereference inCreateDiagnosticAtReferenceSyntax.Impact: a tool that builds its own program for a repository that references a non-composite project kills the whole API server process, losing every open snapshot, and the tool sees only an EOF. That is an ordinary monorepo setup, where
tsc -preports TS6306 and keeps going, so an analyzer on the API stops on that repository instead of analyzing it.CreateDiagnosticAtReferenceSyntaxnow returns nil whenConfigFileis nil, and its caller inverifyProjectReferencesalready falls back to a compiler diagnostic in that case.TestCreateProgramReportsNonCompositeProjectReferencecreates such a program with a reference to a non-composite project and expects TS6306 as its only program diagnostic, and it panics without the fix.I met this while building deadset-ts, the TypeScript analyzer of deadset, on the TypeScript 7 API. That work hit a small set of related defects, which is why a few reports come from me.
An AI coding agent wrote this patch. I have read, built and tested it and will handle the review.