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… #6921

Merged
merged 1 commit into from
Sep 26, 2024

Commits on Sep 26, 2024

  1. Move the initializer into the constructor for instance members that r…

    …eference identifiers declared in the constructor.
    
    This updates our OSS code with a change made in cl/678990911, to prevent
    the change being reverted the next time we sync into our internal code
    base.
    
    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.
    groszewn committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    fdba913 View commit details
    Browse the repository at this point in the history