[PR #15422] app/ui: remove explicit any casts in Message and remarkCitationParser #41023

Open
opened 2026-04-23 01:46:27 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

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

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


📝 Commits (1)

  • 87a000c app/ui: remove explicit any casts in Message and remarkCitationParser

📊 Changes

2 files changed (+33 additions, -15 deletions)

View changed files

📝 app/ui/app/src/components/Message.tsx (+13 -9)
📝 app/ui/app/src/utils/remarkCitationParser.ts (+20 -6)

📄 Description

Follows up on #15417. This removes the remaining 11 no-explicit-any ESLint errors in non-generated frontend files. After this and #15417, the only no-explicit-any errors left (88) are in the auto-generated gotypes.gen.ts.

Message.tsx (9 errors): the ToolRoleContent component was casting message to any to access tool_result, tool_name, and toolName. The generated type has tool_result typed as number[] but at runtime it is a JSON object (set via Object.assign in the streaming handler). A ToolMessage intersection type replaces the any casts with a single typed cast, and downstream property access on rawToolResult and argsObj no longer needs any.

remarkCitationParser.ts (2 errors): the second pass cast nodes to any to check for custom citation type and compare cursor values. A getCitationData helper now does the runtime type check and returns typed data, replacing both any casts with a single node.data as CitationData guarded by the type check.

Changes:

  • Message.tsx: add ToolMessage type, remove 9 any casts in ToolRoleContent and ToolCallDisplay
  • remarkCitationParser.ts: add CitationData interface and getCitationData helper, remove 2 any casts

Combined with #15282 and #15417, this brings ESLint errors from 117 to 101 (all in auto-generated code).


🔄 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/15422 **Author:** [@matteocelani](https://github.com/matteocelani) **Created:** 4/8/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/remove-explicit-any-part2` --- ### 📝 Commits (1) - [`87a000c`](https://github.com/ollama/ollama/commit/87a000ca86f266da55632c02f0164b2241890254) app/ui: remove explicit any casts in Message and remarkCitationParser ### 📊 Changes **2 files changed** (+33 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `app/ui/app/src/components/Message.tsx` (+13 -9) 📝 `app/ui/app/src/utils/remarkCitationParser.ts` (+20 -6) </details> ### 📄 Description Follows up on #15417. This removes the remaining 11 `no-explicit-any` ESLint errors in non-generated frontend files. After this and #15417, the only `no-explicit-any` errors left (88) are in the auto-generated `gotypes.gen.ts`. `Message.tsx` (9 errors): the `ToolRoleContent` component was casting `message` to `any` to access `tool_result`, `tool_name`, and `toolName`. The generated type has `tool_result` typed as `number[]` but at runtime it is a JSON object (set via `Object.assign` in the streaming handler). A `ToolMessage` intersection type replaces the `any` casts with a single typed cast, and downstream property access on `rawToolResult` and `argsObj` no longer needs `any`. `remarkCitationParser.ts` (2 errors): the second pass cast nodes to `any` to check for custom citation type and compare cursor values. A `getCitationData` helper now does the runtime type check and returns typed data, replacing both `any` casts with a single `node.data as CitationData` guarded by the type check. Changes: - `Message.tsx`: add `ToolMessage` type, remove 9 `any` casts in `ToolRoleContent` and `ToolCallDisplay` - `remarkCitationParser.ts`: add `CitationData` interface and `getCitationData` helper, remove 2 `any` casts Combined with #15282 and #15417, this brings ESLint errors from 117 to 101 (all in auto-generated code). --- <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-23 01:46:27 -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#41023