// @ts-nocheck // This file is generated by Umi automatically // DO NOT CHANGE IT MANUALLY! import { getRoutes } from './route' import type { History } from 'E:/project/ks-admin/node_modules/@umijs/renderer-react' type Routes = Awaited>['routes'] type AllRoute = Routes[keyof Routes] type IsRoot = 'parentId' extends keyof T ? false : true // show `/` in not `layout / wrapper` only type GetAllRouteWithoutLayout = Item extends any ? 'isWrapper' extends keyof Item ? never : 'isLayout' extends keyof Item ? never : Item : never type AllRouteWithoutLayout = GetAllRouteWithoutLayout type IndexRoutePathname = '/' extends AllRouteWithoutLayout['path'] ? '/' : never type GetChildrens = T extends any ? IsRoot extends true ? never : T : never type Childrens = GetChildrens type Root = Exclude type AllIds = AllRoute['id'] type GetChildrensByParentId< Id extends AllIds, Item = AllRoute > = Item extends any ? 'parentId' extends keyof Item ? Item['parentId'] extends Id ? Item : never : never : never type RouteObject< Id extends AllIds, Item = GetChildrensByParentId > = IsNever extends true ? '' : Item extends AllRoute ? { [Key in Item['path'] as TrimSlash]: UnionMerge< RouteObject > } : never type GetRootRouteObject = Item extends Root ? { [K in Item['path'] as TrimSlash]: UnionMerge> } : never type MergedResult = UnionMerge> // --- patch history types --- type HistoryTo = Parameters['0'] type HistoryPath = Exclude type UmiPathname = Path | (string & {}) interface UmiPath extends HistoryPath { pathname: UmiPathname } type UmiTo = UmiPathname | UmiPath type UmiPush = (to: UmiTo, state?: any) => void type UmiReplace = (to: UmiTo, state?: any) => void export interface UmiHistory extends History { push: UmiPush replace: UmiReplace } // --- type utils --- type TrimLeftSlash = T extends `/${infer R}` ? TrimLeftSlash : T type TrimRightSlash = T extends `${infer R}/` ? TrimRightSlash : T type TrimSlash = TrimLeftSlash> type IsNever = [T] extends [never] ? true : false type IsEqual = (() => G extends A ? 1 : 2) extends () => G extends B ? 1 : 2 ? true : false type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( k: infer I ) => void ? I : never type UnionMerge = UnionToIntersection extends infer O ? { [K in keyof O]: O[K] } : never type ExcludeEmptyKey = IsEqual extends true ? never : T type PathConcat< TKey extends string, TValue, N = TrimSlash > = TValue extends string ? ExcludeEmptyKey : | ExcludeEmptyKey | `${N & string}${IsNever> extends true ? '' : '/'}${UnionPath}` type UnionPath = { [K in keyof T]-?: PathConcat }[keyof T] type MakeSureLeftSlash = T extends any ? `/${TrimRightSlash}` : never // exclude `/*`, because it always at the top of the IDE tip list type Path> = Exclude, '/*'> | IndexRoutePathname