From be01a939963ae858a3bbbd9d64335f2cc995a732 Mon Sep 17 00:00:00 2001 From: muhammedaltug Date: Wed, 14 Sep 2022 17:28:35 +0300 Subject: [PATCH] add type for route data --- .../packages/core/src/lib/handlers/routes.handler.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/handlers/routes.handler.ts b/npm/ng-packs/packages/core/src/lib/handlers/routes.handler.ts index 9ddc03e493..49bdc745c3 100644 --- a/npm/ng-packs/packages/core/src/lib/handlers/routes.handler.ts +++ b/npm/ng-packs/packages/core/src/lib/handlers/routes.handler.ts @@ -1,5 +1,5 @@ import { Injectable, Optional } from '@angular/core'; -import { Router } from '@angular/router'; +import { Route, Router } from '@angular/router'; import { ABP } from '../models'; import { RoutesService } from '../services/routes.service'; @@ -12,7 +12,7 @@ export class RoutesHandler { } addRoutes() { - this.router?.config?.forEach(({ path = '', data }) => { + this.router?.config?.forEach(({ path = '', data }: RouteData) => { if (!data?.routes) return; if (Array.isArray(data.routes)) { @@ -43,3 +43,4 @@ function flatRoutes(routes: RouteDef[], parent: any) { } type RouteDef = ABP.Route & { children: RouteDef[] }; +type RouteData = Route & { data: { routes: RouteDef | Array } };