Skip to content

Fix narrowing of generic this parameters - #64187

Open
Mateusz Burzyński (Andarist) wants to merge 1 commit into
microsoft:mainfrom
Andarist:fix-generic-this-narrowing
Open

Fix narrowing of generic this parameters#64187
Mateusz Burzyński (Andarist) wants to merge 1 commit into
microsoft:mainfrom
Andarist:fix-generic-this-narrowing

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

fixes #64186

Copilot AI balanced review requested due to automatic review settings September 7, 2026 08:18
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 7, 2026
@typescript-automation typescript-automation Bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 7, 2026

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.

🟢 Approval recommended

The focused checker change consistently matches parameter behavior and is covered by comprehensive regression baselines.

Pull request overview

Aligns control-flow narrowing of generic this parameters with ordinary parameters, fixing #64186.

Changes:

  • Applies narrowable constraint types to this references while preserving check modes.
  • Adds regression tests for direct, aliased, contextual, indexed, and inferential usage.
  • Adds diagnostic, type, and symbol baselines.
File summaries
File Description
tsc/internal/checker/checker.go Enables consistent narrowing for generic this.
tsc/testdata/tests/cases/compiler/controlFlowGenericThis.ts Tests core narrowing behavior.
tsc/testdata/tests/cases/compiler/controlFlowGenericThisContextual.ts Tests contextual and inferential behavior.
tsc/testdata/baselines/reference/compiler/controlFlowGenericThis.errors.txt Records expected diagnostics.
tsc/testdata/baselines/reference/compiler/controlFlowGenericThis.types Records inferred types.
tsc/testdata/baselines/reference/compiler/controlFlowGenericThis.symbols Records resolved symbols.
tsc/testdata/baselines/reference/compiler/controlFlowGenericThisContextual.types Records contextual inferred types.
tsc/testdata/baselines/reference/compiler/controlFlowGenericThisContextual.symbols Records contextual symbols.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 0
  • Review effort level: Balanced

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

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

Labels

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

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Narrowing of generic this is inconsistent with variable narrowing

2 participants