Skip to content

Commit

Permalink
core-api: tweak route ref types
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
  • Loading branch information
Rugvip committed Mar 4, 2021
1 parent 61e5bdb commit 0755fc6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions packages/core-api/src/routing/RouteRef.ts
Expand Up @@ -31,13 +31,14 @@ export type RouteRefConfig<Params extends AnyParams> = {
title: string;
};

class RouteRefBaseBase {
class RouteRefBase {
constructor(type: string, id: string) {
this.toString = () => `routeRef{type=${type},id=${id}}`;
}
}

export class RouteRefImpl<Params extends AnyParams> extends RouteRefBaseBase {
export class RouteRefImpl<Params extends AnyParams> extends RouteRefBase
implements RouteRef<Params> {
readonly [routeRefType] = 'absolute';

constructor(private readonly config: RouteRefConfig<Params>) {
Expand Down Expand Up @@ -92,7 +93,7 @@ export function createRouteRef<
export class ExternalRouteRefImpl<
Params extends AnyParams,
Optional extends boolean
> extends RouteRefBaseBase {
> extends RouteRefBase implements ExternalRouteRef<Params, Optional> {
readonly [routeRefType] = 'external';

constructor(
Expand Down
4 changes: 2 additions & 2 deletions packages/core-api/src/routing/types.ts
Expand Up @@ -28,7 +28,7 @@ export const routeRefType: unique symbol = getGlobalSingleton<any>(
);

export type RouteRef<Params extends AnyParams = any> = {
[routeRefType]: 'absolute';
readonly [routeRefType]: 'absolute';

params: ParamKeys<Params>;

Expand All @@ -45,7 +45,7 @@ export type ExternalRouteRef<
Params extends AnyParams = any,
Optional extends boolean = any
> = {
[routeRefType]: 'external';
readonly [routeRefType]: 'external';

params: ParamKeys<Params>;

Expand Down

0 comments on commit 0755fc6

Please sign in to comment.