29 lines
633 B
TypeScript
29 lines
633 B
TypeScript
import { ComponentType } from "react";
|
|
import { RouteComponentProps } from "wouter";
|
|
|
|
interface RouteWithPath {
|
|
path: string;
|
|
nest?: RoutingTree;
|
|
}
|
|
interface RouteWithoutPath {
|
|
path?: never;
|
|
nest?: never;
|
|
}
|
|
interface RouteWithComponent {
|
|
nest?: never;
|
|
component: ComponentType<RouteComponentProps<{}>> | undefined;
|
|
}
|
|
interface RouteWithoutComponent {
|
|
nest: RoutingTree;
|
|
component?: never;
|
|
}
|
|
interface RouteObjectBase {
|
|
name: string;
|
|
icon?: React.FC;
|
|
}
|
|
export type RouteObject = RouteObjectBase &
|
|
(RouteWithPath | RouteWithoutPath) &
|
|
(RouteWithComponent | RouteWithoutComponent);
|
|
|
|
export type RoutingTree = RouteObject[];
|