mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
fix: 消除 sideQuestion.ts 中的 2 个 as any
- toolUse.name: 使用 as unknown as { name: string } 双重断言
- apiErr.error: 使用 as Parameters<typeof formatAPIError>[0] 类型参数
This commit is contained in:
@@ -141,7 +141,10 @@ function extractSideQuestionResponse(messages: Message[]): string | null {
|
|||||||
// No text — check if the model tried to call a tool despite instructions.
|
// No text — check if the model tried to call a tool despite instructions.
|
||||||
const toolUse = assistantBlocks.find(b => b.type === 'tool_use')
|
const toolUse = assistantBlocks.find(b => b.type === 'tool_use')
|
||||||
if (toolUse) {
|
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.)`
|
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',
|
m.type === 'system' && 'subtype' in m && m.subtype === 'api_error',
|
||||||
)
|
)
|
||||||
if (apiErr) {
|
if (apiErr) {
|
||||||
return `(API error: ${formatAPIError(apiErr.error as any)})`
|
return `(API error: ${formatAPIError(apiErr.error as Parameters<typeof formatAPIError>[0])})`
|
||||||
}
|
}
|
||||||
|
|
||||||
return null
|
return null
|
||||||
|
|||||||
Reference in New Issue
Block a user