Skip to content

Conversation

@RussellSprouts
Copy link

Before, in a situation like shown in the test, all of the initializers would be dropped, as the code would try to insert it at the hoisted property which is going to be deleted.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Given this code:

import { Injectable } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

@Injectable()
export class MyClass {
  uninitialized!: string;

  readonly a;
  readonly b;

  constructor(private readonly route: ActivatedRoute) {
    this.a = this.route.get();
    this.b = this.a.get();
  }
}

With the internal migration enabled, the new lines of code would be dropped and this would be the output:

import { Injectable, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

@Injectable()
export class MyClass {}

Issue Number: N/A

What is the new behavior?

import { Injectable, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

@Injectable()
export class MyClass {
  uninitialized!: string;

  private readonly route = inject(ActivatedRoute);
  readonly a = this.route.get();
  readonly b = this.a.get();
}

Does this PR introduce a breaking change?

  • Yes
  • No

The internal migration would result in failures with some files.

Other information

@pullapprove pullapprove bot requested a review from devversion November 21, 2024 19:24
@angular-robot angular-robot bot added the area: migrations Issues related to `ng update`/`ng generate` migrations label Nov 21, 2024
@ngbot ngbot bot added this to the Backlog milestone Nov 21, 2024
@devversion devversion requested review from crisbeto and removed request for devversion November 21, 2024 19:40
@crisbeto crisbeto added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Nov 21, 2024
Before, in a situation like shown in the test, all of the initializers
would be dropped, as the code would try to insert it at the hoisted
property which is going to be deleted.
thePunderWoman pushed a commit that referenced this pull request Nov 21, 2024
…on (#58804)

Before, in a situation like shown in the test, all of the initializers
would be dropped, as the code would try to insert it at the hoisted
property which is going to be deleted.

PR Close #58804
@thePunderWoman
Copy link
Contributor

This PR was merged into the repository by commit 3fc14ec.

The changes were merged into the following branches: main, 19.0.x

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: migrations Issues related to `ng update`/`ng generate` migrations target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants