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:
Rado Kirov
2018-06-18 16:38:33 -07:00
committed by Miško Hevery
parent 39c7769c9e
commit c95437f15d
189 changed files with 1273 additions and 632 deletions

View File

@ -1088,7 +1088,8 @@ import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util'
@Component({selector: 'form-control-comp', template: `<input type="text" [formControl]="control">`})
export class FormControlComp {
control: FormControl;
// TODO(issue/24571): remove '!'.
control !: FormControl;
}
@Component({
@ -1099,10 +1100,14 @@ export class FormControlComp {
</form>`
})
export class FormGroupComp {
control: FormControl;
form: FormGroup;
myGroup: FormGroup;
event: Event;
// TODO(issue/24571): remove '!'.
control !: FormControl;
// TODO(issue/24571): remove '!'.
form !: FormGroup;
// TODO(issue/24571): remove '!'.
myGroup !: FormGroup;
// TODO(issue/24571): remove '!'.
event !: Event;
}
@Component({
@ -1110,7 +1115,8 @@ export class FormGroupComp {
template: `<input type="number" [formControl]="control">`
})
class FormControlNumberInput {
control: FormControl;
// TODO(issue/24571): remove '!'.
control !: FormControl;
}
@Component({
@ -1269,7 +1275,8 @@ class NgModelSelectMultipleWithCustomCompareFnForm {
`
})
class NgModelSelectMultipleForm {
selectedCities: any[];
// TODO(issue/24571): remove '!'.
selectedCities !: any[];
cities: any[] = [];
}
@ -1278,7 +1285,8 @@ class NgModelSelectMultipleForm {
template: `<input type="range" [formControl]="control">`
})
class FormControlRangeInput {
control: FormControl;
// TODO(issue/24571): remove '!'.
control !: FormControl;
}
@Component({selector: 'ng-model-range-form', template: '<input type="range" [(ngModel)]="val">'})
@ -1299,7 +1307,8 @@ class NgModelRangeForm {
<input type="radio" [formControl]="showRadio" value="no">`
})
export class FormControlRadioButtons {
form: FormGroup;
// TODO(issue/24571): remove '!'.
form !: FormGroup;
showRadio = new FormControl('yes');
}
@ -1316,8 +1325,10 @@ export class FormControlRadioButtons {
`
})
class NgModelRadioForm {
food: string;
drink: string;
// TODO(issue/24571): remove '!'.
food !: string;
// TODO(issue/24571): remove '!'.
drink !: string;
}
@Directive({
@ -1330,7 +1341,8 @@ class NgModelRadioForm {
})
class WrappedValue implements ControlValueAccessor {
value: any;
onChange: Function;
// TODO(issue/24571): remove '!'.
onChange !: Function;
writeValue(value: any) { this.value = `!${value}!`; }
@ -1345,7 +1357,8 @@ class WrappedValue implements ControlValueAccessor {
@Component({selector: 'my-input', template: ''})
export class MyInput implements ControlValueAccessor {
@Output('input') onInput = new EventEmitter();
value: string;
// TODO(issue/24571): remove '!'.
value !: string;
constructor(cd: NgControl) { cd.valueAccessor = this; }
@ -1366,7 +1379,8 @@ export class MyInput implements ControlValueAccessor {
</div>`
})
export class MyInputForm {
form: FormGroup;
// TODO(issue/24571): remove '!'.
form !: FormGroup;
}
@Component({
@ -1377,7 +1391,8 @@ export class MyInputForm {
</div>`
})
class WrappedValueForm {
form: FormGroup;
// TODO(issue/24571): remove '!'.
form !: FormGroup;
}
@Component({
@ -1388,9 +1403,11 @@ class WrappedValueForm {
providers: [{provide: NG_VALUE_ACCESSOR, multi: true, useExisting: NgModelCustomComp}]
})
export class NgModelCustomComp implements ControlValueAccessor {
model: string;
// TODO(issue/24571): remove '!'.
model !: string;
@Input('disabled') isDisabled: boolean = false;
changeFn: (value: any) => void;
// TODO(issue/24571): remove '!'.
changeFn !: (value: any) => void;
writeValue(value: any) { this.model = value; }
@ -1410,6 +1427,7 @@ export class NgModelCustomComp implements ControlValueAccessor {
`
})
export class NgModelCustomWrapper {
name: string;
// TODO(issue/24571): remove '!'.
name !: string;
isDisabled = false;
}