From 3c9c2d183adc976a1ee1bd2ce2dc2177a72430b7 Mon Sep 17 00:00:00 2001 From: Matteo Celani <26189482+matteocelani@users.noreply.github.com> Date: Wed, 8 Apr 2026 11:27:05 +0200 Subject: [PATCH 1/2] app/ui: remove explicit any casts in ChatForm, MessageList, ModelPicker, and ThinkButton - ChatForm.tsx: type ref with closeDropdown method instead of casting to any - MessageList.tsx: replace any on browserToolResult with inline type, remove unnecessary any casts on message tool_calls that are already typed - ModelPicker.tsx: type ref cast with closeDropdown method - ThinkButton.tsx: type ref cast with closeDropdown method Reduces ESLint no-explicit-any errors from 112 to 101. --- app/ui/app/src/components/ChatForm.tsx | 12 ++++++------ app/ui/app/src/components/MessageList.tsx | 8 ++++---- app/ui/app/src/components/ModelPicker.tsx | 3 ++- app/ui/app/src/components/ThinkButton.tsx | 3 ++- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/ui/app/src/components/ChatForm.tsx b/app/ui/app/src/components/ChatForm.tsx index 78e50ffd1..ec9b8f294 100644 --- a/app/ui/app/src/components/ChatForm.tsx +++ b/app/ui/app/src/components/ChatForm.tsx @@ -102,9 +102,9 @@ function ChatForm({ const fileInputRef = useRef(null); const textareaRef = useRef(null); const thinkButtonRef = useRef(null); - const thinkingLevelButtonRef = useRef(null); + const thinkingLevelButtonRef = useRef void }>(null); const webSearchButtonRef = useRef(null); - const modelPickerRef = useRef(null); + const modelPickerRef = useRef void }>(null); const submitButtonRef = useRef(null); const { mutate: sendMessageMutation } = useSendMessage(chatId); @@ -126,9 +126,9 @@ function ChatForm({ if ( isOpen && modelPickerRef.current && - (modelPickerRef.current as any).closeDropdown + modelPickerRef.current.closeDropdown ) { - (modelPickerRef.current as any).closeDropdown(); + modelPickerRef.current.closeDropdown(); } }; @@ -136,9 +136,9 @@ function ChatForm({ if ( isOpen && thinkingLevelButtonRef.current && - (thinkingLevelButtonRef.current as any).closeDropdown + thinkingLevelButtonRef.current.closeDropdown ) { - (thinkingLevelButtonRef.current as any).closeDropdown(); + thinkingLevelButtonRef.current.closeDropdown(); } }; diff --git a/app/ui/app/src/components/MessageList.tsx b/app/ui/app/src/components/MessageList.tsx index 63c87b5d0..b9e39e324 100644 --- a/app/ui/app/src/components/MessageList.tsx +++ b/app/ui/app/src/components/MessageList.tsx @@ -23,7 +23,7 @@ export default function MessageList({ onEditMessage?: (content: string, index: number) => void | Promise; editingMessageIndex?: number; error?: ErrorEvent | null; - browserToolResult?: any; + browserToolResult?: { page_stack: string[] }; }) { const [showDots, setShowDots] = React.useState(false); const isDownloadingModel = downloadProgress && !downloadProgress.done; @@ -54,9 +54,9 @@ export default function MessageList({ const queries: (string | undefined)[] = []; let lastQuery: string | undefined = undefined; for (let i = 0; i < messages.length; i++) { - const m: any = messages[i] as any; - const toolCalls: any[] | undefined = Array.isArray(m?.tool_calls) - ? (m.tool_calls as any[]) + const m = messages[i]; + const toolCalls = Array.isArray(m?.tool_calls) + ? m.tool_calls : m?.tool_call ? [m.tool_call] : undefined; diff --git a/app/ui/app/src/components/ModelPicker.tsx b/app/ui/app/src/components/ModelPicker.tsx index 2dba77d8c..648186a6b 100644 --- a/app/ui/app/src/components/ModelPicker.tsx +++ b/app/ui/app/src/components/ModelPicker.tsx @@ -89,7 +89,8 @@ export const ModelPicker = forwardRef< useEffect(() => { if (ref && typeof ref === "object" && ref.current) { - (ref.current as any).closeDropdown = () => setIsOpen(false); + const mutableRef = ref as React.MutableRefObject void }>; + mutableRef.current.closeDropdown = () => setIsOpen(false); } }, [ref, setIsOpen]); diff --git a/app/ui/app/src/components/ThinkButton.tsx b/app/ui/app/src/components/ThinkButton.tsx index ff940267d..2d05f0222 100644 --- a/app/ui/app/src/components/ThinkButton.tsx +++ b/app/ui/app/src/components/ThinkButton.tsx @@ -46,7 +46,8 @@ export const ThinkButton = forwardRef( ref.current && mode === "thinkingLevel" ) { - (ref.current as any).closeDropdown = () => setIsDropdownOpen(false); + const mutableRef = ref as React.MutableRefObject void }>; + mutableRef.current.closeDropdown = () => setIsDropdownOpen(false); } }, [ref, mode]); From 6dc6d37ab64429dee613c6c16637c083f8a43d66 Mon Sep 17 00:00:00 2001 From: Matteo Celani <26189482+matteocelani@users.noreply.github.com> Date: Wed, 8 Apr 2026 15:59:56 +0200 Subject: [PATCH 2/2] app/ui: replace any casts with ChatEvent type in useChats streaming handler The tool_result event handler was casting event to any to access toolResultData and toolName, but these fields already exist on the ChatEvent type. Use ChatEvent instead of any since the switch case guarantees the event type. --- app/ui/app/src/hooks/useChats.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/ui/app/src/hooks/useChats.ts b/app/ui/app/src/hooks/useChats.ts index 2493e5bee..476202d70 100644 --- a/app/ui/app/src/hooks/useChats.ts +++ b/app/ui/app/src/hooks/useChats.ts @@ -1,6 +1,6 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { getChats, getChat, sendMessage, type ChatEventUnion } from "../api"; -import { Chat, ErrorEvent, Model } from "@/gotypes"; +import { Chat, ChatEvent, ErrorEvent, Model } from "@/gotypes"; import { Message } from "@/gotypes"; import { useSelectedModel } from "./useSelectedModel"; import { createQueryBatcher } from "./useQueryBatcher"; @@ -568,9 +568,9 @@ export const useSendMessage = (chatId: string) => { thinkingTimeEnd: event.thinkingTimeEnd, }), { - tool_result: (event as any).toolResultData, - ...((event as any).toolName - ? { tool_name: (event as any).toolName } + tool_result: (event as ChatEvent).toolResultData, + ...((event as ChatEvent).toolName + ? { tool_name: (event as ChatEvent).toolName } : {}), }, ),