@@ -122,7 +122,7 @@ export function createEmptyStateSnapshot(rootComponent: Type<any> | null): Route
122122 *
123123 * @publicApi
124124 */
125- export class ActivatedRoute {
125+ export class ActivatedRoute < T extends Data = Data > {
126126 /** The current snapshot of this route */
127127 snapshot ! : ActivatedRouteSnapshot ;
128128 /** @internal */
@@ -146,7 +146,7 @@ export class ActivatedRoute {
146146 /** An observable of the URL fragment shared by all the routes. */
147147 public fragment : Observable < string | null > ;
148148 /** An observable of the static and resolved data of this route. */
149- public data : Observable < Data > ;
149+ public data : Observable < T > ;
150150
151151 /** @internal */
152152 constructor (
@@ -159,15 +159,15 @@ export class ActivatedRoute {
159159 /** @internal */
160160 public fragmentSubject : BehaviorSubject < string | null > ,
161161 /** @internal */
162- public dataSubject : BehaviorSubject < Data > ,
162+ public dataSubject : BehaviorSubject < T > ,
163163 /** The outlet name of the route, a constant. */
164164 public outlet : string ,
165165 /** The component of the route, a constant. */
166166 public component : Type < any > | null ,
167167 futureSnapshot : ActivatedRouteSnapshot ,
168168 ) {
169169 this . _futureSnapshot = futureSnapshot ;
170- this . title = this . dataSubject ?. pipe ( map ( ( d : Data ) => d [ RouteTitleKey ] ) ) ?? of ( undefined ) ;
170+ this . title = this . dataSubject ?. pipe ( map ( ( d : T ) => d [ RouteTitleKey ] ) ) ?? of ( undefined ) ;
171171 // TODO(atscott): Verify that these can be changed to `.asObservable()` with TGP.
172172 this . url = urlSubject ;
173173 this . params = paramsSubject ;
@@ -318,7 +318,7 @@ export function getInherited(
318318 *
319319 * @publicApi
320320 */
321- export class ActivatedRouteSnapshot {
321+ export class ActivatedRouteSnapshot < T extends Data = Data > {
322322 /** The configuration used to match this route **/
323323 public readonly routeConfig : Route | null ;
324324 /** @internal */
@@ -368,7 +368,7 @@ export class ActivatedRouteSnapshot {
368368 /** The URL fragment shared by all the routes */
369369 public fragment : string | null ,
370370 /** The static and resolved data of this route */
371- public data : Data ,
371+ public data : T ,
372372 /** The outlet name of the route */
373373 public outlet : string ,
374374 /** The component of the route */
0 commit comments