Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the initializer into the constructor for instance members that r… #2867

Merged
merged 5 commits into from
Feb 27, 2025

Conversation

bjaspan
Copy link
Contributor

@bjaspan bjaspan commented Feb 26, 2025

…eference identifiers declared in the constructor.

When TypeScript outputs modern language features, the below case throws an TS error.

class C {
a = this.x; // TS2729: Property 'x' is used before its initialization.

constructor(public x:number){}
}
This error is fixed by moving the initializer of such class members into the constructor.

This is a no-op change. This change came from Google.

…eference identifiers declared in the constructor.

When TypeScript outputs modern language features, the below case throws an TS error.

class C {
  a = this.x; // TS2729: Property 'x' is used before its initialization.

  constructor(public x:number){}
}
This error is fixed by moving the initializer of such class members into the constructor.

This is a no-op change
@bjaspan bjaspan requested a review from a team as a code owner February 26, 2025 21:37
@AndreasArvidsson AndreasArvidsson added this pull request to the merge queue Feb 27, 2025
Merged via the queue into cursorless-dev:main with commit 34a6bf5 Feb 27, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants