## 问题描述 代码里大量使用 `any` 类型,类型安全完全失控: 1. Zustand store 用 any(#26) 2. catch 块用 any(#23) 3. mock 数据文件没有类型定义(#39) 4. API 请求参数用 any(多个地方) ```typescript interface AppState { currentUser: any; // 完全不知道结构 setCurrentUser: (user: any) => void; } } catch (error: any) { // error 是什么不知道 return NextResponse.json({ error: error.message }); } ``` ## 影响范围 - IDE 提示失效 - 重构时容易出 bug - 新人无法了解数据结构 ## 建议方案 ### 1. 定义基础类型 ```typescript interface User { id: string; email: string; name: string; role: 'admin' | 'teacher' | 'hr'; avatar?: string; department?: string; } ``` ### 2. catch 块用 unknown ```typescript } catch (error) { const message = error instanceof Error ? error.message : 'Unknown error'; console.error('Error:', error); return NextResponse.json({ error: message }, { status: 500 }); } ``` ### 3. 给所有 mock 数据加类型定义 ## 相关 Issue(建议关闭) - 类型安全:Zustand store 状态用 any(#26) - 类型安全:catch 块里直接用 any(#23) - 类型缺失:mock 数据文件没有类型定义(#39) --- 本 Issue 由 <a href="https://github.com/minorcell/memo-code">Memo Code</a> 生成。 @hjx2289206 @AlkaidSTART