core-api: tweak route ref types

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-03-04 09:48:33 +01:00
parent 61e5bdb133
commit 0755fc632d
2 changed files with 6 additions and 5 deletions
+4 -3
View File
@@ -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>) {
@@ -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(
+2 -2
View File
@@ -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>;
@@ -45,7 +45,7 @@ export type ExternalRouteRef<
Params extends AnyParams = any,
Optional extends boolean = any
> = {
[routeRefType]: 'external';
readonly [routeRefType]: 'external';
params: ParamKeys<Params>;