收紧后端 TypeScript:统一 Json 类型与 TaskContext 契约

关闭 allowJs;集中 JsonObject 定义并替换分散 any 别名;parseTaskContext 返回 TaskContext;任务详情 API 标注 AdminTaskDetailView;测试减少 as any。
This commit is contained in:
yml2213
2026-07-10 15:52:05 +08:00
parent e7244eaa5e
commit 8bcd9bbd81
79 changed files with 415 additions and 259 deletions
+2 -1
View File
@@ -6,6 +6,7 @@ import util from 'node:util'
import { PROJECT_ROOT, runtimeConfig } from '../config/runtime.js'
import type { HttpErrorLike } from './http.js'
import { maskSecret } from './masking.js'
import { asJsonObject } from '../types/json.js'
type LogLevel = 'debug' | 'info' | 'warn' | 'error'
type LogChannel = 'app' | 'integration'
@@ -362,7 +363,7 @@ function isSensitiveLogKey(key: unknown): boolean {
function normalizeExternalHttpPacketDetail(
detail: ExternalHttpPacketDetail,
): ExternalHttpPacketDetail {
const source = detail && typeof detail === 'object' && !Array.isArray(detail) ? detail : {}
const source = asJsonObject(detail)
const normalized: ExternalHttpPacketDetail = {}
for (const [key, value] of Object.entries(source)) {