mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 17:42:15 +08:00
fix(angular): avoid TS 2.8 features
This commit is contained in:
@ -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
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user