[PR #15417] app/ui: remove explicit any casts in ChatForm, MessageList, ModelPicker, ThinkButton, and useChats #25686

Open
opened 2026-04-19 18:21:24 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15417
Author: @matteocelani
Created: 4/8/2026
Status: 🔄 Open

Base: mainHead: fix/remove-explicit-any-part1


📝 Commits (2)

  • 3c9c2d1 app/ui: remove explicit any casts in ChatForm, MessageList, ModelPicker, and ThinkButton
  • 6dc6d37 app/ui: replace any casts with ChatEvent type in useChats streaming handler

📊 Changes

5 files changed (+18 additions, -16 deletions)

View changed files

📝 app/ui/app/src/components/ChatForm.tsx (+6 -6)
📝 app/ui/app/src/components/MessageList.tsx (+4 -4)
📝 app/ui/app/src/components/ModelPicker.tsx (+2 -1)
📝 app/ui/app/src/components/ThinkButton.tsx (+2 -1)
📝 app/ui/app/src/hooks/useChats.ts (+4 -4)

📄 Description

Follows up on #15282. This removes 14 no-explicit-any ESLint errors from 5 frontend files by replacing any casts with proper types. No behavior changes.

The closeDropdown pattern (components exposing a method via ref mutation) was the main source — now typed with HTMLButtonElement & { closeDropdown?: () => void } instead of casting to any. The MessageList tool call parsing was using unnecessary any casts on already-typed ToolCall[] properties. The useChats streaming handler was casting events to any to access toolResultData and toolName, but these fields already exist on the ChatEvent type.

Changes:

  • ChatForm.tsx: type modelPickerRef and thinkingLevelButtonRef with closeDropdown method (4 errors)
  • MessageList.tsx: type browserToolResult prop, remove any casts on tool_calls (5 errors)
  • ModelPicker.tsx: type ref cast with closeDropdown method (1 error)
  • ThinkButton.tsx: type ref cast with closeDropdown method (1 error)
  • useChats.ts: replace (event as any) with (event as ChatEvent) in tool_result handler (3 errors)

Reduces total ESLint errors from 112 to 98. The remaining 98 are mostly in auto-generated gotypes.gen.ts (88).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15417 **Author:** [@matteocelani](https://github.com/matteocelani) **Created:** 4/8/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/remove-explicit-any-part1` --- ### 📝 Commits (2) - [`3c9c2d1`](https://github.com/ollama/ollama/commit/3c9c2d183adc976a1ee1bd2ce2dc2177a72430b7) app/ui: remove explicit any casts in ChatForm, MessageList, ModelPicker, and ThinkButton - [`6dc6d37`](https://github.com/ollama/ollama/commit/6dc6d37ab64429dee613c6c16637c083f8a43d66) app/ui: replace any casts with ChatEvent type in useChats streaming handler ### 📊 Changes **5 files changed** (+18 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `app/ui/app/src/components/ChatForm.tsx` (+6 -6) 📝 `app/ui/app/src/components/MessageList.tsx` (+4 -4) 📝 `app/ui/app/src/components/ModelPicker.tsx` (+2 -1) 📝 `app/ui/app/src/components/ThinkButton.tsx` (+2 -1) 📝 `app/ui/app/src/hooks/useChats.ts` (+4 -4) </details> ### 📄 Description Follows up on #15282. This removes 14 `no-explicit-any` ESLint errors from 5 frontend files by replacing `any` casts with proper types. No behavior changes. The `closeDropdown` pattern (components exposing a method via ref mutation) was the main source — now typed with `HTMLButtonElement & { closeDropdown?: () => void }` instead of casting to `any`. The `MessageList` tool call parsing was using unnecessary `any` casts on already-typed `ToolCall[]` properties. The `useChats` streaming handler was casting events to `any` to access `toolResultData` and `toolName`, but these fields already exist on the `ChatEvent` type. Changes: - `ChatForm.tsx`: type `modelPickerRef` and `thinkingLevelButtonRef` with `closeDropdown` method (4 errors) - `MessageList.tsx`: type `browserToolResult` prop, remove `any` casts on `tool_calls` (5 errors) - `ModelPicker.tsx`: type ref cast with `closeDropdown` method (1 error) - `ThinkButton.tsx`: type ref cast with `closeDropdown` method (1 error) - `useChats.ts`: replace `(event as any)` with `(event as ChatEvent)` in tool_result handler (3 errors) Reduces total ESLint errors from 112 to 98. The remaining 98 are mostly in auto-generated `gotypes.gen.ts` (88). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 18:21:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#25686