Skip to content

Fix flaky diagnostic on JS constructor-defined properties - #64646

Merged
Wesley Wigham (weswigham) merged 1 commit into
microsoft:mainfrom
weswigham:fix-js-constructor-property-flaky-diag
Oct 6, 2026
Merged

Wesley Wigham (weswigham) merged 1 commit into
microsoft:mainfrom
weswigham:fix-js-constructor-property-flaky-diag

Conversation

@weswigham

Copy link
Copy Markdown
Member

Fixes a flaky diagnostic reported in the server logs. Only some checker entrypoints would trigger getTypeOfSymbol on constructor-declared properties (implicit any errors from widening the auto type), making the diagnostic depend on if emit had occurred already using a given checker or not.

Now we always check them. (Previously, sometimes only their flow type would be calculated - diagnostics wouldn't be issued.)

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.

Copilot review overview

🟢 Approval recommended

The focused checker change is comprehensively covered across class forms, inference cases, and compiler-option combinations.

Review effort: Balanced
Findings: None

What changed in this PR

Ensures JavaScript constructor-defined properties are consistently type-checked, eliminating emit-dependent diagnostic behavior.

Changes:

  • Explicitly resolves constructor-declared property types for class declarations and expressions.
  • Adds regression coverage across emit and strict-null-check configurations.
File Description
tsc/​internal/​checker/​checker.go Checks constructor-defined JavaScript properties consistently.
tsc/​testdata/​tests/​cases/​compiler/​flakyDiagnosticsJsClassPropertyInitializedToUndefined.ts Adds regression scenarios for property inference and diagnostics.
...(noemit=true,strictnullchecks=true).types Records strict/no-emit inferred types.
...(noemit=true,strictnullchecks=true).symbols Records strict/no-emit symbols.
...(noemit=true,strictnullchecks=true).errors.txt Records strict/no-emit diagnostics.
...(noemit=true,strictnullchecks=false).types Records non-strict/no-emit inferred types.
...(noemit=true,strictnullchecks=false).symbols Records non-strict/no-emit symbols.
...(noemit=true,strictnullchecks=false).errors.txt Records non-strict/no-emit diagnostics.
...(noemit=false,strictnullchecks=true).types Records strict/emit inferred types.
...(noemit=false,strictnullchecks=true).symbols Records strict/emit symbols.
...(noemit=false,strictnullchecks=true).js Records strict JavaScript and declaration emit.
...(noemit=false,strictnullchecks=true).errors.txt Records strict/emit diagnostics.
...(noemit=false,strictnullchecks=false).types Records non-strict/emit inferred types.
...(noemit=false,strictnullchecks=false).symbols Records non-strict/emit symbols.
...(noemit=false,strictnullchecks=false).js Records non-strict JavaScript and declaration emit.
...(noemit=false,strictnullchecks=false).errors.txt Records non-strict/emit diagnostics.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@weswigham
Wesley Wigham (weswigham) added this pull request to the merge queue Oct 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 5, 2026
@weswigham
Wesley Wigham (weswigham) added this pull request to the merge queue Oct 6, 2026
Merged via the queue into microsoft:main with commit a1ef42b Oct 6, 2026
29 checks passed
@weswigham
Wesley Wigham (weswigham) deleted the fix-js-constructor-property-flaky-diag branch October 6, 2026 00:18
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

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants