build(bazel): Turning on strictPropertyInitialization for Angular. (#24572)
All errors for existing fields have been detected and suppressed with a `!` assertion. Issue/24571 is tracking proper clean up of those instances. One-line change required in ivy/compilation.ts, because it appears that the new syntax causes tsickle emitted node to no longer track their original sourceFiles. PR Close #24572
This commit is contained in:
@ -80,7 +80,8 @@ withEachNg1Version(() => {
|
||||
|
||||
@Component({selector: 'my-app', template: '<my-child [value]="value"></my-child>'})
|
||||
class AppComponent {
|
||||
value: number;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
value !: number;
|
||||
constructor() { appComponent = this; }
|
||||
}
|
||||
|
||||
@ -89,7 +90,8 @@ withEachNg1Version(() => {
|
||||
template: '<div>{{ valueFromPromise }}</div>',
|
||||
})
|
||||
class ChildComponent {
|
||||
valueFromPromise: number;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
valueFromPromise !: number;
|
||||
@Input()
|
||||
set value(v: number) { expect(NgZone.isInAngularZone()).toBe(true); }
|
||||
|
||||
|
@ -60,7 +60,8 @@ withEachNg1Version(() => {
|
||||
it('should correctly project structural directives', async(() => {
|
||||
@Component({selector: 'ng2', template: 'ng2-{{ itemId }}(<ng-content></ng-content>)'})
|
||||
class Ng2Component {
|
||||
@Input() itemId: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() itemId !: string;
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
|
@ -418,8 +418,10 @@ withEachNg1Version(() => {
|
||||
class Ng2Component implements OnChanges {
|
||||
ngOnChangesCount = 0;
|
||||
firstChangesCount = 0;
|
||||
initialValue: string;
|
||||
@Input() foo: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
initialValue !: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() foo !: string;
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
this.ngOnChangesCount++;
|
||||
|
@ -29,7 +29,8 @@ withEachNg1Version(() => {
|
||||
// component
|
||||
@Directive({selector: 'ng1'})
|
||||
class Ng1Component extends UpgradeComponent {
|
||||
@Input() title: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() title !: string;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1', elementRef, injector);
|
||||
@ -42,7 +43,8 @@ withEachNg1Version(() => {
|
||||
template: 'ng2[<ng1 [title]="nameProp">transclude</ng1>](<ng-content></ng-content>)'
|
||||
})
|
||||
class Ng2Component {
|
||||
@Input('name') nameProp: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input('name') nameProp !: string;
|
||||
}
|
||||
|
||||
// This module represents the Angular pieces of the application
|
||||
|
@ -476,8 +476,10 @@ withEachNg1Version(() => {
|
||||
// Define `Ng1ComponentFacade`
|
||||
@Directive({selector: 'ng1'})
|
||||
class Ng1ComponentFacade extends UpgradeComponent {
|
||||
@Input('inputAttrA') inputA: string;
|
||||
@Input() inputB: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input('inputAttrA') inputA !: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() inputB !: string;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1', elementRef, injector);
|
||||
@ -551,8 +553,10 @@ withEachNg1Version(() => {
|
||||
// Define `Ng1ComponentFacade`
|
||||
@Directive({selector: 'ng1'})
|
||||
class Ng1ComponentFacade extends UpgradeComponent {
|
||||
@Input('inputAttrA') inputA: string;
|
||||
@Input() inputB: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input('inputAttrA') inputA !: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() inputB !: string;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1', elementRef, injector);
|
||||
@ -626,10 +630,14 @@ withEachNg1Version(() => {
|
||||
// Define `Ng1ComponentFacade`
|
||||
@Directive({selector: 'ng1'})
|
||||
class Ng1ComponentFacade extends UpgradeComponent {
|
||||
@Input('inputAttrA') inputA: string;
|
||||
@Output('inputAttrAChange') inputAChange: EventEmitter<any>;
|
||||
@Input() inputB: string;
|
||||
@Output() inputBChange: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input('inputAttrA') inputA !: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output('inputAttrAChange') inputAChange !: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() inputB !: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output() inputBChange !: EventEmitter<any>;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1', elementRef, injector);
|
||||
@ -701,8 +709,10 @@ withEachNg1Version(() => {
|
||||
// Define `Ng1ComponentFacade`
|
||||
@Directive({selector: 'ng1'})
|
||||
class Ng1ComponentFacade extends UpgradeComponent {
|
||||
@Output('outputAttrA') outputA: EventEmitter<any>;
|
||||
@Output() outputB: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output('outputAttrA') outputA !: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output() outputB !: EventEmitter<any>;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1', elementRef, injector);
|
||||
@ -783,13 +793,17 @@ withEachNg1Version(() => {
|
||||
// Define `Ng1ComponentFacade`
|
||||
@Directive({selector: 'ng1'})
|
||||
class Ng1ComponentFacade extends UpgradeComponent {
|
||||
@Input() fullName: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() fullName !: string;
|
||||
@Input('dataA') modelA: any;
|
||||
@Input('dataB') modelB: any;
|
||||
@Output('dataBChange') modelBChange: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output('dataBChange') modelBChange !: EventEmitter<any>;
|
||||
@Input() modelC: any;
|
||||
@Output() modelCChange: EventEmitter<any>;
|
||||
@Output() event: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output() modelCChange !: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output() event !: EventEmitter<any>;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1', elementRef, injector);
|
||||
@ -862,12 +876,18 @@ withEachNg1Version(() => {
|
||||
// Define `Ng1ComponentFacade`
|
||||
@Directive({selector: 'ng1'})
|
||||
class Ng1ComponentFacade extends UpgradeComponent {
|
||||
@Input('inputAttrA') inputA: string;
|
||||
@Output('inputAttrAChange') inputAChange: EventEmitter<any>;
|
||||
@Input() inputB: string;
|
||||
@Output() inputBChange: EventEmitter<any>;
|
||||
@Output('outputAttrA') outputA: EventEmitter<any>;
|
||||
@Output() outputB: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input('inputAttrA') inputA !: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output('inputAttrAChange') inputAChange !: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() inputB !: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output() inputBChange !: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output('outputAttrA') outputA !: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output() outputB !: EventEmitter<any>;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1', elementRef, injector);
|
||||
@ -957,9 +977,12 @@ withEachNg1Version(() => {
|
||||
// Define `Ng1ComponentFacade`
|
||||
@Directive({selector: '[ng1]'})
|
||||
class Ng1ComponentFacade extends UpgradeComponent {
|
||||
@Input() inputA: string;
|
||||
@Output() inputAChange: EventEmitter<any>;
|
||||
@Output() outputA: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() inputA !: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output() inputAChange !: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output() outputA !: EventEmitter<any>;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1', elementRef, injector);
|
||||
@ -1319,7 +1342,9 @@ withEachNg1Version(() => {
|
||||
scope: true,
|
||||
controllerAs: 'vm',
|
||||
controller: class {
|
||||
hasElement: string; isClass: string; scope: string;
|
||||
hasElement: string; // TODO(issue/24571): remove '!'.
|
||||
isClass !: string;
|
||||
scope: string;
|
||||
|
||||
constructor(public $element: angular.IAugmentedJQuery, $scope: angular.IScope) {
|
||||
this.hasElement = $element[0].nodeName;
|
||||
@ -1393,7 +1418,8 @@ withEachNg1Version(() => {
|
||||
// Define `Ng1ComponentFacade`
|
||||
@Directive({selector: 'ng1A'})
|
||||
class Ng1ComponentAFacade extends UpgradeComponent {
|
||||
@Input() title: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() title !: string;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1A', elementRef, injector);
|
||||
@ -1402,7 +1428,8 @@ withEachNg1Version(() => {
|
||||
|
||||
@Directive({selector: 'ng1B'})
|
||||
class Ng1ComponentBFacade extends UpgradeComponent {
|
||||
@Input() title: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() title !: string;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1B', elementRef, injector);
|
||||
@ -1459,7 +1486,8 @@ withEachNg1Version(() => {
|
||||
// Define `Ng1ComponentFacade`
|
||||
@Directive({selector: 'ng1'})
|
||||
class Ng1ComponentFacade extends UpgradeComponent {
|
||||
@Input() title: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() title !: string;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1', elementRef, injector);
|
||||
@ -1508,7 +1536,8 @@ withEachNg1Version(() => {
|
||||
// Define `Ng1ComponentFacade`
|
||||
@Directive({selector: 'ng1'})
|
||||
class Ng1ComponentFacade extends UpgradeComponent {
|
||||
@Input() title: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() title !: string;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1', elementRef, injector);
|
||||
@ -3336,7 +3365,8 @@ withEachNg1Version(() => {
|
||||
@Component(
|
||||
{selector: 'ng2', template: '<div *ngIf="show"><ng1A></ng1A> | <ng1B></ng1B></div>'})
|
||||
class Ng2Component {
|
||||
@Input() show: boolean;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() show !: boolean;
|
||||
}
|
||||
|
||||
// Define `ng1Module`
|
||||
@ -3436,7 +3466,8 @@ withEachNg1Version(() => {
|
||||
@Component(
|
||||
{selector: 'ng2', template: '<div *ngIf="show"><ng1A></ng1A> | <ng1B></ng1B></div>'})
|
||||
class Ng2Component {
|
||||
@Input() show: boolean;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() show !: boolean;
|
||||
}
|
||||
|
||||
// Define `ng1Module`
|
||||
@ -3720,7 +3751,8 @@ withEachNg1Version(() => {
|
||||
|
||||
// Define `ng1Component`
|
||||
class Ng1ControllerX {
|
||||
ng1XInputA: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
ng1XInputA !: string;
|
||||
ng1XInputB: any;
|
||||
ng1XInputC: any;
|
||||
|
||||
@ -3748,12 +3780,16 @@ withEachNg1Version(() => {
|
||||
// Define `Ng1ComponentFacade`
|
||||
@Directive({selector: 'ng1X'})
|
||||
class Ng1ComponentXFacade extends UpgradeComponent {
|
||||
@Input() ng1XInputA: string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() ng1XInputA !: string;
|
||||
@Input() ng1XInputB: any;
|
||||
@Input() ng1XInputC: any;
|
||||
@Output() ng1XInputCChange: EventEmitter<any>;
|
||||
@Output() ng1XOutputA: EventEmitter<any>;
|
||||
@Output() ng1XOutputB: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output() ng1XInputCChange !: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output() ng1XOutputA !: EventEmitter<any>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Output() ng1XOutputB !: EventEmitter<any>;
|
||||
|
||||
constructor(elementRef: ElementRef, injector: Injector) {
|
||||
super('ng1X', elementRef, injector);
|
||||
|
Reference in New Issue
Block a user