From 67fc846ba36bf9f040d4c66db8c2eaa2a02e5c82 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 4 Dec 2025 20:26:16 -0600 Subject: [PATCH] Use stricter input validation in renderSpecialContent (remove type assertions) --- src/components/AIMessageItem.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/AIMessageItem.tsx b/src/components/AIMessageItem.tsx index f2c6294b..b922e283 100644 --- a/src/components/AIMessageItem.tsx +++ b/src/components/AIMessageItem.tsx @@ -219,19 +219,19 @@ export const AIMessageItem = memo(({ // Special rendering for tools const renderSpecialContent = () => { - if (toolName === 'text_editor_write' && toolArgs.file_text) { + if (toolName === 'text_editor_write' && typeof toolArgs.file_text === 'string') { return (
- {toolArgs.file_text as string} + {toolArgs.file_text}
); } - if (toolName === 'text_editor_str_replace' && toolArgs.old_str && toolArgs.new_str) { - const oldLines = (toolArgs.old_str as string).split('\n'); - const newLines = (toolArgs.new_str as string).split('\n'); + if (toolName === 'text_editor_str_replace' && typeof toolArgs.old_str === 'string' && typeof toolArgs.new_str === 'string') { + const oldLines = toolArgs.old_str.split('\n'); + const newLines = toolArgs.new_str.split('\n'); return (