Revert "Fix RouteNode type error"

This commit is contained in:
robin 2022-11-02 13:15:52 +08:00 committed by GitHub
parent ffb2b6ddc8
commit 53501a3692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 17 deletions

View File

@ -2,10 +2,9 @@ import React, { Suspense, lazy } from 'react';
import { RouteObject, createBrowserRouter } from 'react-router-dom';
import Layout from '@answer/pages/Layout';
import routeConfig from '@/router/route-config';
import routeConfig, { RouteNode } from '@/router/route-config';
import RouteRules from '@/router/route-rules';
import { RouteNode } from '@/router/types';
const routes: RouteObject[] = [];

View File

@ -1,5 +1,10 @@
import { RouteNode } from '@/router/types';
import { RouteObject } from 'react-router-dom';
export interface RouteNode extends RouteObject {
page: string;
children?: RouteNode[];
rules?: string[];
}
const routeConfig: RouteNode[] = [
{
path: '/',

View File

@ -1,14 +0,0 @@
import { IndexRouteObject, NonIndexRouteObject } from 'react-router-dom';
type CustomRouteObject = {
page: string;
rules?: string[];
};
type IndexRouteNode = IndexRouteObject & CustomRouteObject;
interface NonIndexRouteNode extends NonIndexRouteObject, CustomRouteObject {
children?: (IndexRouteNode | NonIndexRouteNode)[];
}
export type RouteNode = IndexRouteNode | NonIndexRouteNode;