test(tools): use type-safe error assertions instead of any casts

oxlint's no-unsafe-member-access rejects member access through an any
cast; the error info is reachable through the declared optional chain.
This commit is contained in:
Chinesezjc
2026-08-11 15:36:10 +08:00
parent 610dc74ea8
commit 47f108bf50
2 changed files with 3 additions and 6 deletions

View File

@@ -754,8 +754,7 @@ describe('code-mode native-tool denial through the agent loop', () => {
const sessionEvents = events(agent)
const toolResult = sessionEvents.find(e => e.type === 'tool/result')
expect(toolResult).toBeDefined()
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- tool/result data uses a loose event payload union
expect((toolResult!.data as any).error).toMatchObject({
expect(toolResult!.data.error).toMatchObject({
name: 'ToolNotFoundError',
code: 'UNKNOWN_TOOL',
})