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

@ -92,14 +92,21 @@ import {UrlTree} from '../url_tree';
*/
@Directive({selector: ':not(a)[routerLink]'})
export class RouterLink {
@Input() queryParams: {[k: string]: any};
@Input() fragment: string;
@Input() queryParamsHandling: QueryParamsHandling;
@Input() preserveFragment: boolean;
@Input() skipLocationChange: boolean;
@Input() replaceUrl: boolean;
// TODO(issue/24571): remove '!'.
@Input() queryParams !: {[k: string]: any};
// TODO(issue/24571): remove '!'.
@Input() fragment !: string;
// TODO(issue/24571): remove '!'.
@Input() queryParamsHandling !: QueryParamsHandling;
// TODO(issue/24571): remove '!'.
@Input() preserveFragment !: boolean;
// TODO(issue/24571): remove '!'.
@Input() skipLocationChange !: boolean;
// TODO(issue/24571): remove '!'.
@Input() replaceUrl !: boolean;
private commands: any[] = [];
private preserve: boolean;
// TODO(issue/24571): remove '!'.
private preserve !: boolean;
constructor(
private router: Router, private route: ActivatedRoute,
@ -164,19 +171,28 @@ export class RouterLink {
*/
@Directive({selector: 'a[routerLink]'})
export class RouterLinkWithHref implements OnChanges, OnDestroy {
@HostBinding('attr.target') @Input() target: string;
@Input() queryParams: {[k: string]: any};
@Input() fragment: string;
@Input() queryParamsHandling: QueryParamsHandling;
@Input() preserveFragment: boolean;
@Input() skipLocationChange: boolean;
@Input() replaceUrl: boolean;
// TODO(issue/24571): remove '!'.
@HostBinding('attr.target') @Input() target !: string;
// TODO(issue/24571): remove '!'.
@Input() queryParams !: {[k: string]: any};
// TODO(issue/24571): remove '!'.
@Input() fragment !: string;
// TODO(issue/24571): remove '!'.
@Input() queryParamsHandling !: QueryParamsHandling;
// TODO(issue/24571): remove '!'.
@Input() preserveFragment !: boolean;
// TODO(issue/24571): remove '!'.
@Input() skipLocationChange !: boolean;
// TODO(issue/24571): remove '!'.
@Input() replaceUrl !: boolean;
private commands: any[] = [];
private subscription: Subscription;
private preserve: boolean;
// TODO(issue/24571): remove '!'.
private preserve !: boolean;
// the url displayed on the anchor element.
@HostBinding() href: string;
// TODO(issue/24571): remove '!'.
@HostBinding() href !: string;
constructor(
private router: Router, private route: ActivatedRoute,

View File

@ -78,9 +78,12 @@ import {RouterLink, RouterLinkWithHref} from './router_link';
})
export class RouterLinkActive implements OnChanges,
OnDestroy, AfterContentInit {
@ContentChildren(RouterLink, {descendants: true}) links: QueryList<RouterLink>;
// TODO(issue/24571): remove '!'.
@ContentChildren(RouterLink, {descendants: true})
links !: QueryList<RouterLink>;
// TODO(issue/24571): remove '!'.
@ContentChildren(RouterLinkWithHref, {descendants: true})
linksWithHrefs: QueryList<RouterLinkWithHref>;
linksWithHrefs !: QueryList<RouterLinkWithHref>;
private classes: string[] = [];
private subscription: Subscription;

View File

@ -214,7 +214,8 @@ export class Router {
private rawUrlTree: UrlTree;
private navigations = new BehaviorSubject<NavigationParams>(null !);
private locationSubscription: Subscription;
// TODO(issue/24571): remove '!'.
private locationSubscription !: Subscription;
private navigationId: number = 0;
private configLoader: RouterConfigLoader;
private ngModule: NgModuleRef<any>;

View File

@ -72,7 +72,8 @@ export class NoPreloading implements PreloadingStrategy {
@Injectable()
export class RouterPreloader implements OnDestroy {
private loader: RouterConfigLoader;
private subscription: Subscription;
// TODO(issue/24571): remove '!'.
private subscription !: Subscription;
constructor(
private router: Router, moduleLoader: NgModuleFactoryLoader, compiler: Compiler,

View File

@ -14,8 +14,10 @@ import {NavigationEnd, NavigationStart, Scroll} from './events';
import {Router} from './router';
export class RouterScroller implements OnDestroy {
private routerEventsSubscription: Unsubscribable;
private scrollEventsSubscription: Unsubscribable;
// TODO(issue/24571): remove '!'.
private routerEventsSubscription !: Unsubscribable;
// TODO(issue/24571): remove '!'.
private scrollEventsSubscription !: Unsubscribable;
private lastId = 0;
private lastSource: 'imperative'|'popstate'|'hashchange'|undefined = 'imperative';

View File

@ -106,15 +106,19 @@ export function createEmptyStateSnapshot(
*/
export class ActivatedRoute {
/** The current snapshot of this route */
snapshot: ActivatedRouteSnapshot;
// TODO(issue/24571): remove '!'.
snapshot !: ActivatedRouteSnapshot;
/** @internal */
_futureSnapshot: ActivatedRouteSnapshot;
/** @internal */
_routerState: RouterState;
// TODO(issue/24571): remove '!'.
_routerState !: RouterState;
/** @internal */
_paramMap: Observable<ParamMap>;
// TODO(issue/24571): remove '!'.
_paramMap !: Observable<ParamMap>;
/** @internal */
_queryParamMap: Observable<ParamMap>;
// TODO(issue/24571): remove '!'.
_queryParamMap !: Observable<ParamMap>;
/** @internal */
constructor(
@ -257,13 +261,17 @@ export class ActivatedRouteSnapshot {
/** @internal */
_resolve: ResolveData;
/** @internal */
_resolvedData: Data;
// TODO(issue/24571): remove '!'.
_resolvedData !: Data;
/** @internal */
_routerState: RouterStateSnapshot;
// TODO(issue/24571): remove '!'.
_routerState !: RouterStateSnapshot;
/** @internal */
_paramMap: ParamMap;
// TODO(issue/24571): remove '!'.
_paramMap !: ParamMap;
/** @internal */
_queryParamMap: ParamMap;
// TODO(issue/24571): remove '!'.
_queryParamMap !: ParamMap;
/** @internal */
constructor(

View File

@ -104,7 +104,8 @@ function containsSegmentGroupHelper(
*/
export class UrlTree {
/** @internal */
_queryParamMap: ParamMap;
// TODO(issue/24571): remove '!'.
_queryParamMap !: ParamMap;
/** @internal */
constructor(
@ -137,9 +138,11 @@ export class UrlTree {
*/
export class UrlSegmentGroup {
/** @internal */
_sourceSegment: UrlSegmentGroup;
// TODO(issue/24571): remove '!'.
_sourceSegment !: UrlSegmentGroup;
/** @internal */
_segmentIndexShift: number;
// TODO(issue/24571): remove '!'.
_segmentIndexShift !: number;
/** The parent node in the url tree */
parent: UrlSegmentGroup|null = null;
@ -189,7 +192,8 @@ export class UrlSegmentGroup {
*/
export class UrlSegment {
/** @internal */
_parameterMap: ParamMap;
// TODO(issue/24571): remove '!'.
_parameterMap !: ParamMap;
constructor(
/** The path part of a URL segment */

View File

@ -73,8 +73,10 @@ describe('Integration', () => {
`
})
class ComponentWithRouterLink {
@ViewChild(TemplateRef) templateRef: TemplateRef<any>;
@ViewChild('container', {read: ViewContainerRef}) container: ViewContainerRef;
// TODO(issue/24571): remove '!'.
@ViewChild(TemplateRef) templateRef !: TemplateRef<any>;
// TODO(issue/24571): remove '!'.
@ViewChild('container', {read: ViewContainerRef}) container !: ViewContainerRef;
addLink() {
this.container.createEmbeddedView(this.templateRef, {$implicit: '/simple'});