Skip to content

Assert checker errors cannot use the Message diagnostic category - #65318

Open
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 5 commits into
mainfrom
copilot/ts1450-fix-import-args-category
Open

Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 5 commits into
mainfrom
copilot/ts1450-fix-import-args-category

Conversation

Copilot AI commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #65309

Analysis

TS1450 exposes a missing invariant: the checker can issue an error with category Message, causing editors to display information instead of an error. The category correction is handled separately.

Fix

  • Assertion: Reject Message-category diagnostics in Checker.addDiagnostic, covering both semantic and grammar errors.
  • Coverage: Verify rejection while preserving Message-category related information.

Existing TS1450 cases intentionally panic until the separate category fix lands.

Copilot Checklist

Validation was run but fails on the intended TS1450 assertion:

  • npx hereby validate
  • npx hereby validate --api (for TypeScript API changes)

Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix TS1450 to report error instead of message Assert checker errors cannot use the Message diagnostic category Nov 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot just remove the testcase please

Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>

Copilot AI commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Copilot just remove the testcase please

Removed the added test file in 3570fb4; the assertion is unchanged.

@RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh) marked this pull request as ready for review November 5, 2026 19:45
Copilot AI balanced review requested due to automatic review settings November 5, 2026 19:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

TS1450 still has CategoryMessage, so the always-active assertion turns an ordinary import() grammar error into a checker panic instead of a diagnostic.

1 open issue
What changed in this PR

Adds a checker invariant to prevent diagnostics from being reported as informational messages rather than errors, addressing the enforcement gap exposed by TS1450.

Changes:

  • Adds an assertion in Checker.addDiagnostic covering semantic and grammar diagnostics.
  • Leaves Message-category related information unaffected; the TS1450 category correction is handled separately.
File Description
tsc/​internal/​checker/​checker.go Rejects top-level Message-category diagnostics when adding checker diagnostics.

Review effort: Balanced

Comment thread tsc/internal/checker/checker.go Resolved

This branch has not been deployed

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

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TS1450 (wrong number of import() arguments) is reported with category "message" instead of "error"

3 participants