-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.d.ts
More file actions
50 lines (44 loc) · 1.24 KB
/
app.d.ts
File metadata and controls
50 lines (44 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
/**
* 数据列表分页查询参数
*/
interface PaginationSearchParams {
/** 当前页数 */
pn?: number;
/** 每页条数 */
ps?: number;
/** default: createdAt,DESC */
// orderBy?: string | string[];
}
type DeepPartial<T> = Partial<{ [P in keyof T]: DeepPartial<T[P]> }>;
declare type AppPage<Params = {}, SearchParams = {}> = import('next').NextPage<{
params: Promise<Params>;
searchParams: Promise<SearchParams>;
}>;
/**
* 至少三种状态(1.初始化,2.成功,3.失败)
* 1.initial
* 2.success
* 3.fail
*/
type ServerActionState<Errors = any, Data = any> = {
status: import('@/actions').ActionStatus;
message?: string | null;
errors?: {
[key in Errors]: string;
};
data?: Data;
} | null | undefined;
interface FormServerAction<Payload = unknown, State = ServerActionState> {
(payload: Payload, state?: Awaited<State>): Promise<State>;
}
type ServerAction<Payload = unknown, State = ServerActionState> =
| FormServerAction
| ((payload: Payload) => Promise<State>);
type WithFormProps = {
/**
* 后台系统中表单常见模式定义
*/
mode?: 'create' | 'edit' | 'view' | 'duplicate' | 'approval' | 'draft';
data?: any;
};