From 3c960323d7763600bbdc6edf5d52ccfaec726a9d Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Tue, 9 Jun 2026 23:03:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B6=88=E9=99=A4=20sideQuestion.ts=20?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=202=20=E4=B8=AA=20as=20any?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - toolUse.name: 使用 as unknown as { name: string } 双重断言 - apiErr.error: 使用 as Parameters[0] 类型参数 --- src/utils/sideQuestion.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/sideQuestion.ts b/src/utils/sideQuestion.ts index 441abdf33..2d3dabfc7 100644 --- a/src/utils/sideQuestion.ts +++ b/src/utils/sideQuestion.ts @@ -141,7 +141,10 @@ function extractSideQuestionResponse(messages: Message[]): string | null { // No text — check if the model tried to call a tool despite instructions. const toolUse = assistantBlocks.find(b => b.type === 'tool_use') if (toolUse) { - const toolName = 'name' in toolUse ? (toolUse as any).name : 'a tool' + const toolName = + 'name' in toolUse + ? (toolUse as unknown as { name: string }).name + : 'a tool' return `(The model tried to call ${toolName} instead of answering directly. Try rephrasing or ask in the main conversation.)` } } @@ -153,7 +156,7 @@ function extractSideQuestionResponse(messages: Message[]): string | null { m.type === 'system' && 'subtype' in m && m.subtype === 'api_error', ) if (apiErr) { - return `(API error: ${formatAPIError(apiErr.error as any)})` + return `(API error: ${formatAPIError(apiErr.error as Parameters[0])})` } return null