mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 登录页面开始迁移
This commit is contained in:
6
src/typings/common/route.d.ts
vendored
6
src/typings/common/route.d.ts
vendored
@ -24,7 +24,7 @@ declare namespace AuthRoute {
|
||||
: `/${Key}`;
|
||||
|
||||
/** 路由路径 */
|
||||
type RoutePath<Key extends string = ''> =
|
||||
type RoutePath<Key extends string = string> =
|
||||
| '/'
|
||||
| Exclude<KeyToPath<RouteKey>, '/root' | '/redirect'>
|
||||
| Key
|
||||
@ -66,11 +66,11 @@ declare namespace AuthRoute {
|
||||
};
|
||||
|
||||
/** 单个路由的类型结构(后端返回此类型结构的路由) */
|
||||
interface Route {
|
||||
interface Route<T extends string = ''> {
|
||||
/** 路由名称(路由唯一标识) */
|
||||
name: RouteKey;
|
||||
/** 路由路径 */
|
||||
path: RoutePath;
|
||||
path: RoutePath<T>;
|
||||
/** 路由重定向 */
|
||||
redirect?: RoutePath;
|
||||
/**
|
||||
|
17
src/typings/common/util.d.ts
vendored
Normal file
17
src/typings/common/util.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
declare namespace Util {
|
||||
/** convert a union to an intersection: X | Y | Z ==> X & Y & Z */
|
||||
type UnionToIntersection<T> = (T extends any ? (args: T) => any : never) extends (args: infer R) => any ? R : never;
|
||||
|
||||
/** returns true if the type is a union otherwise false */
|
||||
type IsUnion<T> = [T] extends [UnionToIntersection<T>] ? false : true;
|
||||
|
||||
type LastInUnion<T> = UnionToIntersection<T extends any ? (arg: T) => any : never> extends (arg: infer R) => any
|
||||
? R
|
||||
: never;
|
||||
|
||||
type UnionToTuple<T, U = T> = [T] extends [never]
|
||||
? []
|
||||
: [LastInUnion<T>, ...UnionToTuple<Exclude<U, LastInUnion<T>>>];
|
||||
|
||||
type Inter = UnionToTuple<'1' | '2'>;
|
||||
}
|
Reference in New Issue
Block a user