From 76965c5e8cf2299867c05031178477e735cb103d Mon Sep 17 00:00:00 2001 From: James Feng <47167674+GhostDragon124@users.noreply.github.com> Date: Sun, 7 Jun 2026 11:08:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(tsc):=20Phase=203b=20=E2=80=94=20fix=2021?= =?UTF-8?q?=20type=20errors=20in=20PowerShell/Bash/MCP=20UI=20(141?= =?UTF-8?q?=E2=86=92120)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../builtin-tools/src/tools/BashTool/UI.tsx | 19 +++++++++++++++++-- .../builtin-tools/src/tools/MCPTool/UI.tsx | 13 ++++++++++++- .../src/tools/PowerShellTool/UI.tsx | 19 +++++++++++++++++-- 3 files changed, 46 insertions(+), 5 deletions(-) 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 (