fix: 修复 TypeScript 编译错误

修复以下问题:
- QuestionManagement.tsx: 修复 label 类型转换错误,使用 String() 确保类型安全
- UserDetail.tsx: 移除未使用的 Space 导入
- WrongQuestions.tsx: 显式声明 onChange 回调参数类型
- WrongQuestions.tsx: 使用空值合并运算符处理可能为 undefined 的值

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
燕陇琪 2025-11-08 19:10:56 +08:00
parent 344ccd7a44
commit 77bd709613
3 changed files with 3 additions and 4 deletions

View File

@ -439,7 +439,7 @@ const QuestionManagement: React.FC = () => {
allowClear allowClear
showSearch showSearch
filterOption={(input, option) => filterOption={(input, option) =>
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()) String(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
} }
/> />
</Form.Item> </Form.Item>

View File

@ -4,7 +4,6 @@ import {
Card, Card,
Button, Button,
Typography, Typography,
Space,
message, message,
Tag, Tag,
Row, Row,

View File

@ -239,7 +239,7 @@ const WrongQuestions: React.FC = () => {
placeholder="排序方式" placeholder="排序方式"
style={{ width: 140 }} style={{ width: 140 }}
defaultValue="time" defaultValue="time"
onChange={(value) => setFilter({ ...filter, sort: value })} onChange={(value: 'time' | 'wrong_count' | 'mastery_level') => setFilter({ ...filter, sort: value })}
> >
<Option value="time"></Option> <Option value="time"></Option>
<Option value="wrong_count"></Option> <Option value="wrong_count"></Option>
@ -251,7 +251,7 @@ const WrongQuestions: React.FC = () => {
type="primary" type="primary"
icon={<PlayCircleOutlined />} icon={<PlayCircleOutlined />}
onClick={handlePractice} onClick={handlePractice}
disabled={!wrongQuestions.length || (stats?.total_wrong === stats?.mastered && stats?.total_wrong > 0)} disabled={!wrongQuestions.length || (stats?.total_wrong === stats?.mastered && (stats?.total_wrong ?? 0) > 0)}
className={styles.primaryButton} className={styles.primaryButton}
> >