diff --git a/packages/builtin-tools/src/tools/BashTool/UI.tsx b/packages/builtin-tools/src/tools/BashTool/UI.tsx index 9917019c5..e86ca0ba8 100644 --- a/packages/builtin-tools/src/tools/BashTool/UI.tsx +++ b/packages/builtin-tools/src/tools/BashTool/UI.tsx @@ -17,6 +17,21 @@ import { getDisplayPath } from 'src/utils/file.js' import { isFullscreenEnvEnabled } from 'src/utils/fullscreen.js' import type { ThemeName } from 'src/utils/theme.js' import type { BashProgress, BashToolInput, Out } from '@claude-code-best/builtin-tools/tools/BashTool/BashTool.js' + +/** + * Local type describing the actual runtime shape of Bash progress data. + * BashProgress is `Record`, so we need a concrete shape + * for property access without resorting to `as any`. + */ +type BashProgressData = { + fullOutput?: string + output?: string + elapsedTimeSeconds?: number + totalLines?: number + totalBytes?: number + timeoutMs?: number + taskId?: string +} import BashToolResultMessage from '@claude-code-best/builtin-tools/tools/BashTool/BashToolResultMessage.js' import { extractBashCommentLabel } from '@claude-code-best/builtin-tools/tools/BashTool/commentLabel.js' import { parseSedEditCommand } from '@claude-code-best/builtin-tools/tools/BashTool/sedEditParser.js' @@ -147,7 +162,7 @@ export function renderToolUseProgressMessage( ) } - const data = lastProgress.data + const data = lastProgress.data as BashProgressData return ( `, so we need a concrete shape + * for property access without resorting to `as any`. + */ +type MCPProgressData = { + progress?: number; + total?: number; + progressMessage?: string; +}; + // Threshold for displaying warning about large MCP responses const MCP_OUTPUT_WARNING_THRESHOLD_TOKENS = 10_000; @@ -69,7 +80,7 @@ export function renderToolUseProgressMessage( ); } - const { progress, total, progressMessage } = lastProgress.data; + const { progress, total, progressMessage } = lastProgress.data as MCPProgressData; if (progress === undefined) { return ( diff --git a/packages/builtin-tools/src/tools/PowerShellTool/UI.tsx b/packages/builtin-tools/src/tools/PowerShellTool/UI.tsx index 75c35ee6b..0e48c19d8 100644 --- a/packages/builtin-tools/src/tools/PowerShellTool/UI.tsx +++ b/packages/builtin-tools/src/tools/PowerShellTool/UI.tsx @@ -13,6 +13,21 @@ import type { PowerShellProgress } from 'src/types/tools.js'; import type { ThemeName } from 'src/utils/theme.js'; import type { Out, PowerShellToolInput } from './PowerShellTool.js'; +/** + * Local type describing the actual runtime shape of PowerShell progress data. + * PowerShellProgress is `Record`, so we need a concrete shape + * for property access without resorting to `as any`. + */ +type PowerShellProgressData = { + fullOutput?: string; + output?: string; + elapsedTimeSeconds?: number; + totalLines?: number; + totalBytes?: number; + timeoutMs?: number; + taskId?: string; +}; + // Constants for command display const MAX_COMMAND_DISPLAY_LINES = 2; const MAX_COMMAND_DISPLAY_CHARS = 160; @@ -75,7 +90,7 @@ export function renderToolUseProgressMessage( ); } - const data = lastProgress.data; + const data = lastProgress.data as PowerShellProgressData; return (