refactor(router): compatibility with typescript strict flag (#30993)

As part of FW-1265, the `@angular/router` package is made compatible
with the TypeScript `--strict` flag. Read more about the strict flag [here](https://www.typescriptlang.org/docs/handbook/compiler-options.html)

PR Close #30993
This commit is contained in:
Paul Gschwendtner
2019-06-13 21:15:45 +02:00
committed by Miško Hevery
parent 18f0c2f1d4
commit ce9d0de840
4 changed files with 12 additions and 9 deletions

View File

@ -11,7 +11,7 @@ import {Attribute, Directive, ElementRef, HostBinding, HostListener, Input, OnCh
import {Subscription} from 'rxjs';
import {QueryParamsHandling} from '../config';
import {NavigationEnd, RouterEvent} from '../events';
import {Event, NavigationEnd} from '../events';
import {Router} from '../router';
import {ActivatedRoute} from '../router_state';
import {UrlTree} from '../url_tree';
@ -220,7 +220,7 @@ export class RouterLinkWithHref implements OnChanges, OnDestroy {
constructor(
private router: Router, private route: ActivatedRoute,
private locationStrategy: LocationStrategy) {
this.subscription = router.events.subscribe((s: RouterEvent) => {
this.subscription = router.events.subscribe((s: Event) => {
if (s instanceof NavigationEnd) {
this.updateTargetUrlAndHref();
}

View File

@ -9,7 +9,7 @@
import {AfterContentInit, ContentChildren, Directive, ElementRef, Input, OnChanges, OnDestroy, Optional, QueryList, Renderer2, SimpleChanges} from '@angular/core';
import {Subscription} from 'rxjs';
import {NavigationEnd, RouterEvent} from '../events';
import {Event, NavigationEnd} from '../events';
import {Router} from '../router';
import {RouterLink, RouterLinkWithHref} from './router_link';
@ -95,7 +95,7 @@ export class RouterLinkActive implements OnChanges,
private router: Router, private element: ElementRef, private renderer: Renderer2,
@Optional() private link?: RouterLink,
@Optional() private linkWithHref?: RouterLinkWithHref) {
this.subscription = router.events.subscribe((s: RouterEvent) => {
this.subscription = router.events.subscribe((s: Event) => {
if (s instanceof NavigationEnd) {
this.update();
}