refactor(契约): 判题状态码收进契约唯一一份,并收紧 18 处 as any

- 状态码常量与 judgeStatusSchema 移到 packages/contract/src/judge-status.ts,
  后端 judge/status.ts 只再导出;前端 SubmissionStatus 枚举加编译期断言对齐契约
  (实测改坏一个码会当场类型检查失败)
- 类型逃逸 22 处降到 4 处:collab/handler、pagination、configUpdate、
  ExerciseManager、ProblemSubmission、pk.vue tooltip;剩下的是词云插件无类型、
  生成的 .d.ts、skulpt 和 TextEditor

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Sonnet 5 committed 2026-09-19 04:40:30 -06:00
1 parent f90d01338e
commit b5ba56ccd0
11 files changed
+77 -51

No files matched your search

+2 -3
View File
@@ -198,6 +198,7 @@ export async function handleCollabMessage(ws: CollabSocket, raw: string) {
studentId?: unknown
language?: unknown
reason?: unknown
timestamp?: unknown
}
try {
message = JSON.parse(raw) as typeof message
@@ -213,9 +214,7 @@ export async function handleCollabMessage(ws: CollabSocket, raw: string) {
// 心跳不查库,和 /ws/submissions 的处理一致
if (message.type === "ping") {
ws.send(
JSON.stringify({ type: "pong", timestamp: (message as any).timestamp }),
)
ws.send(JSON.stringify({ type: "pong", timestamp: message.timestamp }))
return
}