Skip to content

fix(checker): detect self-reference in parameter property initializers#62420

Closed
mag123c wants to merge 1 commit intomicrosoft:mainfrom
mag123c:fix/parameter-property-self-reference
Closed

fix(checker): detect self-reference in parameter property initializers#62420
mag123c wants to merge 1 commit intomicrosoft:mainfrom
mag123c:fix/parameter-property-self-reference

Conversation

@mag123c
Copy link
Copy Markdown

@mag123c mag123c commented Sep 9, 2025

Fixes #62414

Problem

Parameter property self-references like constructor(private f = f) were not detected...

Solution

Add checkParameterPropertySelfReference to detect self-references in initializers...

Known Limitations

  • May have false positives in nested scope shadowing cases
  • Future improvement: scope boundary awareness for better precision
  • Priority: Core bug fix over perfect edge case handling

Alternative Approaches Considered

  • Symbol-based comparison: timing issues with parameter property symbol binding
  • Chose conservative name-based approach with property access exclusion

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Sep 9, 2025
@mag123c mag123c force-pushed the fix/parameter-property-self-reference branch from 8670d51 to 56b4588 Compare September 9, 2025 05:57
@RyanCavanaugh
Copy link
Copy Markdown
Member

This is not currently a correct fix. We are not staffed to coach vibecoded PRs and cannot offer further guidance to assist.

@mag123c mag123c closed this Sep 10, 2025
@mag123c
Copy link
Copy Markdown
Author

mag123c commented Sep 10, 2025

I apologize for the inadequate implementation. I'll close this PR and study the codebase more thoroughly before attempting a proper solution. Thank you for the feedback.

@microsoft microsoft locked as resolved and limited conversation to collaborators Mar 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript fails to detect self-reference issue in "Parameter Properties" of constructors

3 participants