diff --git a/core/src/components/router/router.tsx b/core/src/components/router/router.tsx index 2c7a53e860..769b398779 100644 --- a/core/src/components/router/router.tsx +++ b/core/src/components/router/router.tsx @@ -160,9 +160,9 @@ export class Router { const redirect = routeRedirect(path, redirects); let redirectFrom: string[]|null = null; if (redirect) { - this.setPath(redirect.to, intent); + this.setPath(redirect.to!, intent); redirectFrom = redirect.from; - path = redirect.to; + path = redirect.to!; } // lookup route chain diff --git a/core/src/components/router/utils/matching.ts b/core/src/components/router/utils/matching.ts index 94fc3cd24c..a9ade2e1a3 100644 --- a/core/src/components/router/utils/matching.ts +++ b/core/src/components/router/utils/matching.ts @@ -1,7 +1,7 @@ import { RouteChain, RouteID, RouteRedirect } from './interface'; -export function matchesRedirect(input: string[], route: RouteRedirect): route is Required { +export function matchesRedirect(input: string[], route: RouteRedirect): route is RouteRedirect { const {from, to} = route; if (to === undefined) { return false; @@ -24,7 +24,7 @@ export function matchesRedirect(input: string[], route: RouteRedirect): route is } export function routeRedirect(path: string[], routes: RouteRedirect[]) { - return routes.find(route => matchesRedirect(path, route)) as Required | undefined; + return routes.find(route => matchesRedirect(path, route)) as RouteRedirect | undefined; }