core-api: tweak route ref types
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user