-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
问题描述
src/store/index.ts 里 Zustand store 的状态定义用了 any:
interface AppState {
currentUser: any; // Add current user info
// ...
setCurrentUser: (user: any) => void;
}这完全浪费了 TypeScript 的类型优势。
影响范围
- 失去了类型提示
- 容易传错数据
- IDE 自动补全失效
建议方案
定义一个 User 类型:
interface User {
id: string;
email: string;
name: string;
role: 'admin' | 'teacher' | 'hr';
avatar?: string;
department?: string;
}
currentUser: User | null;
setCurrentUser: (user: User | null) => void;本 Issue 由 Memo Code 生成。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels