File tree Expand file tree Collapse file tree 5 files changed +23
-12
lines changed
packages/router-component-store/src/lib Expand file tree Collapse file tree 5 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ import {
2828 Data ,
2929 RouterStateSnapshot ,
3030} from '@angular/router' ;
31+ import { InternalStrictRouteData } from '../../internal-strict-route-data' ;
3132import { InternalStrictRouteParams } from '../../internal-strict-route-params' ;
32- import { StrictRouteData } from '../../strict-route-data' ;
3333import { MinimalActivatedRouteSnapshot } from './minimal-activated-route-state-snapshot' ;
3434import { MinimalRouterStateSnapshot } from './minimal-router-state-snapshot' ;
3535
@@ -44,7 +44,7 @@ export class MinimalRouterStateSerializer {
4444 } ;
4545 }
4646
47- #serializeRouteData( routeData : Data ) : StrictRouteData {
47+ #serializeRouteData( routeData : Data ) : InternalStrictRouteData {
4848 return Object . fromEntries ( Object . entries ( routeData ) ) ;
4949 }
5050
@@ -56,7 +56,9 @@ export class MinimalRouterStateSerializer {
5656 ) ;
5757 return {
5858 params : routeSnapshot . params as InternalStrictRouteParams ,
59- data : this . #serializeRouteData( routeSnapshot . data ) ,
59+ data : this . #serializeRouteData(
60+ routeSnapshot . data
61+ ) as InternalStrictRouteData ,
6062 url : routeSnapshot . url ,
6163 outlet : routeSnapshot . outlet ,
6264 title : routeSnapshot . title ,
Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ import { MinimalActivatedRouteSnapshot } from '../@ngrx/router-store/minimal-act
1414import { MinimalRouterStateSnapshot } from '../@ngrx/router-store/minimal-router-state-snapshot' ;
1515import { MinimalRouterStateSerializer } from '../@ngrx/router-store/minimal_serializer' ;
1616import { filterRouterEvents } from '../filter-router-event.operator' ;
17+ import { InternalStrictRouteData } from '../internal-strict-route-data' ;
1718import { InternalStrictRouteParams } from '../internal-strict-route-params' ;
1819import { RouterStore } from '../router-store' ;
19- import { StrictRouteData } from '../strict-route-data' ;
2020
2121interface GlobalRouterState {
2222 readonly routerState : MinimalRouterStateSnapshot ;
@@ -56,7 +56,7 @@ export class GlobalRouterStore
5656 this . #rootRoute$,
5757 ( route ) => route . queryParams
5858 ) ;
59- routeData$ : Observable < StrictRouteData > = this . select (
59+ routeData$ : Observable < InternalStrictRouteData > = this . select (
6060 this . currentRoute$ ,
6161 ( route ) => route . data
6262 ) ;
Original file line number Diff line number Diff line change 1+ import { Data } from '@angular/router' ;
2+ import { OmitSymbolIndex } from './util-types/omit-symbol-index' ;
3+ import { StrictNoAny } from './util-types/strict-no-any' ;
4+
5+ /**
6+ * @remarks We use this type to ensure compatibility with {@link Data}.
7+ * @internal
8+ */
9+ export type InternalStrictRouteData = Readonly <
10+ StrictNoAny < OmitSymbolIndex < Data > >
11+ > ;
Original file line number Diff line number Diff line change @@ -17,9 +17,9 @@ import { MinimalActivatedRouteSnapshot } from '../@ngrx/router-store/minimal-act
1717import { MinimalRouterStateSnapshot } from '../@ngrx/router-store/minimal-router-state-snapshot' ;
1818import { MinimalRouterStateSerializer } from '../@ngrx/router-store/minimal_serializer' ;
1919import { filterRouterEvents } from '../filter-router-event.operator' ;
20+ import { InternalStrictRouteData } from '../internal-strict-route-data' ;
2021import { InternalStrictRouteParams } from '../internal-strict-route-params' ;
2122import { RouterStore } from '../router-store' ;
22- import { StrictRouteData } from '../strict-route-data' ;
2323
2424interface LocalRouterState {
2525 readonly routerState : MinimalRouterStateSnapshot ;
@@ -45,7 +45,7 @@ export class LocalRouterStore
4545 currentRoute$ : Observable < MinimalActivatedRouteSnapshot > = this . #localRoute;
4646 fragment$ : Observable < string | null > ;
4747 queryParams$ : Observable < InternalStrictRouteParams > ;
48- routeData$ : Observable < StrictRouteData > ;
48+ routeData$ : Observable < InternalStrictRouteData > ;
4949 routeParams$ : Observable < InternalStrictRouteParams > ;
5050 title$ : Observable < string | undefined > ;
5151 url$ : Observable < string > = this . select (
Original file line number Diff line number Diff line change 1- import { Data } from '@angular/router' ;
2- import { OmitSymbolIndex } from './util-types/omit-symbol-index' ;
3- import { StrictNoAny } from './util-types/strict-no-any' ;
4-
51/**
62 * Serializable route `Data` without its symbol index, in particular without the
73 * `Symbol(RouteTitle)` key as this is an internal value for the Angular
84 * `Router`.
95 *
106 * Additionally, the `any` member type is converted to `unknown`.
117 */
12- export type StrictRouteData = Readonly < StrictNoAny < OmitSymbolIndex < Data > > > ;
8+ export interface StrictRouteData {
9+ readonly [ key : string ] : unknown ;
10+ }
You can’t perform that action at this time.
0 commit comments