From 77bd709613bc969f2d54f88fd23ce46717512db3 Mon Sep 17 00:00:00 2001 From: yanlongqi Date: Sat, 8 Nov 2025 19:10:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20TypeScript=20?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复以下问题: - 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 --- web/src/pages/QuestionManagement.tsx | 2 +- web/src/pages/UserDetail.tsx | 1 - web/src/pages/WrongQuestions.tsx | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/web/src/pages/QuestionManagement.tsx b/web/src/pages/QuestionManagement.tsx index 9254a99..4149fc5 100644 --- a/web/src/pages/QuestionManagement.tsx +++ b/web/src/pages/QuestionManagement.tsx @@ -439,7 +439,7 @@ const QuestionManagement: React.FC = () => { allowClear showSearch filterOption={(input, option) => - (option?.label ?? '').toLowerCase().includes(input.toLowerCase()) + String(option?.label ?? '').toLowerCase().includes(input.toLowerCase()) } /> diff --git a/web/src/pages/UserDetail.tsx b/web/src/pages/UserDetail.tsx index d240b09..84a0116 100644 --- a/web/src/pages/UserDetail.tsx +++ b/web/src/pages/UserDetail.tsx @@ -4,7 +4,6 @@ import { Card, Button, Typography, - Space, message, Tag, Row, diff --git a/web/src/pages/WrongQuestions.tsx b/web/src/pages/WrongQuestions.tsx index da7fbe3..514a10f 100644 --- a/web/src/pages/WrongQuestions.tsx +++ b/web/src/pages/WrongQuestions.tsx @@ -239,7 +239,7 @@ const WrongQuestions: React.FC = () => { placeholder="排序方式" style={{ width: 140 }} defaultValue="time" - onChange={(value) => setFilter({ ...filter, sort: value })} + onChange={(value: 'time' | 'wrong_count' | 'mastery_level') => setFilter({ ...filter, sort: value })} > @@ -251,7 +251,7 @@ const WrongQuestions: React.FC = () => { type="primary" icon={} 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} > 开始练习