fix(angular): avoid TS 2.8 features

This commit is contained in:
Manu Mtz.-Almeida
2018-05-23 17:31:24 +02:00
parent c35684e165
commit c736bac32f
2 changed files with 4 additions and 4 deletions

View File

@ -160,9 +160,9 @@ export class Router {
const redirect = routeRedirect(path, redirects); const redirect = routeRedirect(path, redirects);
let redirectFrom: string[]|null = null; let redirectFrom: string[]|null = null;
if (redirect) { if (redirect) {
this.setPath(redirect.to, intent); this.setPath(redirect.to!, intent);
redirectFrom = redirect.from; redirectFrom = redirect.from;
path = redirect.to; path = redirect.to!;
} }
// lookup route chain // lookup route chain

View File

@ -1,7 +1,7 @@
import { RouteChain, RouteID, RouteRedirect } from './interface'; import { RouteChain, RouteID, RouteRedirect } from './interface';
export function matchesRedirect(input: string[], route: RouteRedirect): route is Required<RouteRedirect> { export function matchesRedirect(input: string[], route: RouteRedirect): route is RouteRedirect {
const {from, to} = route; const {from, to} = route;
if (to === undefined) { if (to === undefined) {
return false; return false;
@ -24,7 +24,7 @@ export function matchesRedirect(input: string[], route: RouteRedirect): route is
} }
export function routeRedirect(path: string[], routes: RouteRedirect[]) { export function routeRedirect(path: string[], routes: RouteRedirect[]) {
return routes.find(route => matchesRedirect(path, route)) as Required<RouteRedirect> | undefined; return routes.find(route => matchesRedirect(path, route)) as RouteRedirect | undefined;
} }