Skip to content

Commit 3c96032

Browse files
fix: 消除 sideQuestion.ts 中的 2 个 as any
- toolUse.name: 使用 as unknown as { name: string } 双重断言 - apiErr.error: 使用 as Parameters<typeof formatAPIError>[0] 类型参数
1 parent 2044858 commit 3c96032

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/utils/sideQuestion.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ function extractSideQuestionResponse(messages: Message[]): string | null {
141141
// No text — check if the model tried to call a tool despite instructions.
142142
const toolUse = assistantBlocks.find(b => b.type === 'tool_use')
143143
if (toolUse) {
144-
const toolName = 'name' in toolUse ? (toolUse as any).name : 'a tool'
144+
const toolName =
145+
'name' in toolUse
146+
? (toolUse as unknown as { name: string }).name
147+
: 'a tool'
145148
return `(The model tried to call ${toolName} instead of answering directly. Try rephrasing or ask in the main conversation.)`
146149
}
147150
}
@@ -153,7 +156,7 @@ function extractSideQuestionResponse(messages: Message[]): string | null {
153156
m.type === 'system' && 'subtype' in m && m.subtype === 'api_error',
154157
)
155158
if (apiErr) {
156-
return `(API error: ${formatAPIError(apiErr.error as any)})`
159+
return `(API error: ${formatAPIError(apiErr.error as Parameters<typeof formatAPIError>[0])})`
157160
}
158161

159162
return null

0 commit comments

Comments
 (0)