fix(language-service): Turn on strict mode for test project (#32783)

This is the last part in refactoring of the test project.
This PR turns on strict mode for typechecking and fixed tests that
fail under this mode.

PR Close #32783
This commit is contained in:
Keen Yee Liau
2019-09-19 17:04:02 -07:00
committed by atscott
parent 9e7aa60ae7
commit 28358b6395
8 changed files with 70 additions and 44 deletions

View File

@ -8,7 +8,7 @@
import {Component} from '@angular/core';
export class Hero {
export interface Hero {
id: number;
name: string;
}
@ -30,5 +30,5 @@ export class Hero {
export class AppComponent {
title = 'Tour of Heroes';
hero: Hero = {id: 1, name: 'Windstorm'};
private internal: string;
private internal: string = 'internal';
}

View File

@ -44,5 +44,5 @@ export class ExpectNumericType {
template: '{{ (name | lowercase).~{string-pipe}substring }}',
})
export class LowercasePipe {
name: string;
name: string = 'name';
}

View File

@ -29,7 +29,7 @@ export class UnknownPeople {
</div>`,
})
export class UnknownEven {
people: Person[];
people: Person[] = [];
}
@Component({
@ -39,5 +39,5 @@ export class UnknownEven {
</div>`,
})
export class UnknownTrackBy {
people: Person[];
people: Person[] = [];
}

View File

@ -49,21 +49,21 @@ export class NoValueAttribute {
template: '<h1 model="~{attribute-binding-model}test"></h1>',
})
export class AttributeBinding {
test: string;
test: string = 'test';
}
@Component({
template: '<h1 [model]="~{property-binding-model}test"></h1>',
})
export class PropertyBinding {
test: string;
test: string = 'test';
}
@Component({
template: '<h1 (model)="~{event-binding-model}modelChanged()"></h1>',
})
export class EventBinding {
test: string;
test: string = 'test';
modelChanged() {}
}
@ -72,23 +72,23 @@ export class EventBinding {
template: '<h1 [(model)]="~{two-way-binding-model}test"></h1>',
})
export class TwoWayBinding {
test: string;
test: string = 'test';
}
@Directive({
selector: '[string-model]',
})
export class StringModel {
@Input() model: string;
@Output() modelChanged: EventEmitter<string>;
@Input() model: string = 'model';
@Output() modelChanged: EventEmitter<string> = new EventEmitter();
}
@Directive({
selector: '[number-model]',
})
export class NumberModel {
@Input('inputAlias') model: number;
@Output('outputAlias') modelChanged: EventEmitter<number>;
@Input('inputAlias') model: number = 0;
@Output('outputAlias') modelChanged: EventEmitter<number> = new EventEmitter();
}
interface Person {
@ -122,7 +122,7 @@ export class ForLetIEqual {
</div>`,
})
export class ForUsingComponent {
people: Person[];
people: Person[] = [];
}
@Component({