190fa07b9a
Adds a migration that casts the value of `ActivatedRouteSnapshot.fragment` to be non-nullable. Also moves some code from the `AbstractControl.parent` migration so that it can be reused. Relates to #37336. PR Close #41092 |
||
---|---|---|
.. | ||
BUILD.bazel | ||
README.md | ||
index.ts | ||
util.ts |
README.md
AbstractControl.parent
migration
As of Angular v11, the type of AbstractControl.parent
can be null. This migration automatically
identifies usages and adds non-null assertions.
Before
import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
@Component()
export class MyComponent {
private _control = new FormControl();
getParentValue() {
return this._control.parent.value; // <- Compilation error in v11.
}
}
After
import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
@Component()
export class MyComponent {
private _control = new FormControl();
getParentValue() {
return this._control.parent!.value; // <- Non-null assertion added during the migration.
}
}