Skip to content

Commit

Permalink
fix(router): Remove unused string type for ActivatedRoute.component
Browse files Browse the repository at this point in the history
The type of `component` on `ActivatedRoute` and `ActivatedRouteSnapshot`
includes `string`. In reality, this is not the case. The component
cannot be anything other than a component class.
  • Loading branch information
atscott committed Apr 14, 2022
1 parent 000363e commit a25f826
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions goldens/public-api/router/index.md
Expand Up @@ -33,7 +33,7 @@ import { ViewContainerRef } from '@angular/core';
// @public
export class ActivatedRoute {
get children(): ActivatedRoute[];
component: Type<any> | string | null;
component: Type<any> | null;
data: Observable<Data>;
get firstChild(): ActivatedRoute | null;
fragment: Observable<string | null>;
Expand All @@ -55,7 +55,7 @@ export class ActivatedRoute {
// @public
export class ActivatedRouteSnapshot {
get children(): ActivatedRouteSnapshot[];
component: Type<any> | string | null;
component: Type<any> | null;
data: Data;
get firstChild(): ActivatedRouteSnapshot | null;
fragment: string | null;
Expand Down
5 changes: 2 additions & 3 deletions packages/router/src/router_state.ts
Expand Up @@ -136,8 +136,7 @@ export class ActivatedRoute {
/** The outlet name of the route, a constant. */
public outlet: string,
/** The component of the route, a constant. */
// TODO(vsavkin): remove |string
public component: Type<any>|string|null, futureSnapshot: ActivatedRouteSnapshot) {
public component: Type<any>|null, futureSnapshot: ActivatedRouteSnapshot) {
this._futureSnapshot = futureSnapshot;
}

Expand Down Expand Up @@ -339,7 +338,7 @@ export class ActivatedRouteSnapshot {
/** The outlet name of the route */
public outlet: string,
/** The component of the route */
public component: Type<any>|string|null, routeConfig: Route|null, urlSegment: UrlSegmentGroup,
public component: Type<any>|null, routeConfig: Route|null, urlSegment: UrlSegmentGroup,
lastPathIndex: number, resolve: ResolveData, correctedLastPathIndex?: number) {
this.routeConfig = routeConfig;
this._urlSegment = urlSegment;
Expand Down

0 comments on commit a25f826

Please sign in to comment.