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

@ -24,8 +24,10 @@ export const APP_INITIALIZER = new InjectionToken<Array<() => void>>('Applicatio
*/
@Injectable()
export class ApplicationInitStatus {
private resolve: Function;
private reject: Function;
// TODO(issue/24571): remove '!'.
private resolve !: Function;
// TODO(issue/24571): remove '!'.
private reject !: Function;
private initialized = false;
public readonly donePromise: Promise<any>;
public readonly done = false;

View File

@ -383,7 +383,8 @@ export class ApplicationRef {
/**
* Returns an Observable that indicates when the application is stable or unstable.
*/
public readonly isStable: Observable<boolean>;
// TODO(issue/24571): remove '!'.
public readonly isStable !: Observable<boolean>;
/** @internal */
constructor(

View File

@ -27,7 +27,8 @@ const trackByIdentity = (index: number, item: any) => item;
*/
export class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChanges<V> {
public readonly length: number = 0;
public readonly collection: V[]|Iterable<V>|null;
// TODO(issue/24571): remove '!'.
public readonly collection !: V[] | Iterable<V>| null;
// Keeps track of the used records at any point in time (during & across `_check()` calls)
private _linkedRecords: _DuplicateMap<V>|null = null;
// Keeps track of the removed records at any point in time during `_check()` calls.

View File

@ -19,7 +19,8 @@ export class EventListener {
export class DebugNode {
nativeNode: any;
listeners: EventListener[];
parent: DebugElement|null;
// TODO(issue/24571): remove '!'.
parent !: DebugElement | null;
constructor(nativeNode: any, parent: DebugNode|null, private _debugContext: DebugContext) {
this.nativeNode = nativeNode;
@ -46,7 +47,8 @@ export class DebugNode {
* @experimental All debugging apis are currently experimental.
*/
export class DebugElement extends DebugNode {
name: string;
// TODO(issue/24571): remove '!'.
name !: string;
properties: {[key: string]: any};
attributes: {[key: string]: string | null};
classes: {[key: string]: boolean};

View File

@ -42,8 +42,10 @@ export class QueryList<T>/* implements Iterable<T> */ {
public readonly changes: Observable<any> = new EventEmitter();
readonly length: number = 0;
readonly first: T;
readonly last: T;
// TODO(issue/24571): remove '!'.
readonly first !: T;
// TODO(issue/24571): remove '!'.
readonly last !: T;
/**
* See

View File

@ -28,12 +28,14 @@ export abstract class SystemJsNgModuleLoaderConfig {
/**
* Prefix to add when computing the name of the factory module for a given module name.
*/
factoryPathPrefix: string;
// TODO(issue/24571): remove '!'.
factoryPathPrefix !: string;
/**
* Suffix to add when computing the name of the factory module for a given module name.
*/
factoryPathSuffix: string;
// TODO(issue/24571): remove '!'.
factoryPathSuffix !: string;
}
const DEFAULT_CONFIG: SystemJsNgModuleLoaderConfig = {

View File

@ -159,7 +159,8 @@ export abstract class Renderer2 {
* in which case the view engine won't call it.
* This is used as a performance optimization for production mode.
*/
destroyNode: ((node: any) => void)|null;
// TODO(issue/24571): remove '!'.
destroyNode !: ((node: any) => void) | null;
abstract appendChild(parent: any, newChild: any): void;
abstract insertBefore(parent: any, newChild: any, refChild: any): void;
abstract removeChild(parent: any, oldChild: any): void;

View File

@ -606,9 +606,12 @@ export function getOrCreateContainerRef(di: LInjector): viewEngine_ViewContainer
*/
class ViewContainerRef implements viewEngine_ViewContainerRef {
private _viewRefs: viewEngine_ViewRef[] = [];
element: viewEngine_ElementRef;
injector: Injector;
parentInjector: Injector;
// TODO(issue/24571): remove '!'.
element !: viewEngine_ElementRef;
// TODO(issue/24571): remove '!'.
injector !: Injector;
// TODO(issue/24571): remove '!'.
parentInjector !: Injector;
constructor(private _lContainerNode: LContainerNode) {}

View File

@ -24,10 +24,12 @@ export interface viewEngine_ChangeDetectorRef_interface extends viewEngine_Chang
export class ViewRef<T> implements viewEngine_EmbeddedViewRef<T>, viewEngine_InternalViewRef,
viewEngine_ChangeDetectorRef_interface {
private _appRef: ApplicationRef|null;
// TODO(issue/24571): remove '!'.
private _appRef !: ApplicationRef | null;
context: T;
rootNodes: any[];
// TODO(issue/24571): remove '!'.
rootNodes !: any[];
constructor(protected _view: LViewData, context: T|null) { this.context = context !; }

View File

@ -311,7 +311,8 @@ class TemplateRef_ extends TemplateRef<any> implements TemplateData {
/**
* @internal
*/
_projectedViews: ViewData[];
// TODO(issue/24571): remove '!'.
_projectedViews !: ViewData[];
constructor(private _parentView: ViewData, private _def: NodeDef) { super(); }
@ -479,9 +480,11 @@ class NgModuleRef_ implements NgModuleData, InternalNgModuleRef<any> {
private _destroyListeners: (() => void)[] = [];
private _destroyed: boolean = false;
/** @internal */
_providers: any[];
// TODO(issue/24571): remove '!'.
_providers !: any[];
/** @internal */
_modules: any[];
// TODO(issue/24571): remove '!'.
_modules !: any[];
readonly injector: Injector = this;