refactor(phase-10): complete type safety enhancement

- Add types/api-responses.ts with ApiResponse<T>, PaginatedResponse<T>
- Add types/errors.ts with comprehensive error type hierarchy
- Replace all any usage (53 → 0, 100% reduction)
- Add RawAPI response interfaces for type-safe mapping
- Update catch blocks to use unknown with type narrowing
- Add getState mock to chatStore tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-03-15 19:52:52 +08:00
parent a6b1255dc0
commit 6a66ce159d
9 changed files with 1467 additions and 92 deletions

View File

@@ -1,7 +1,7 @@
import { useEffect, useMemo, useState } from 'react';
import { motion } from 'framer-motion';
import { getStoredGatewayUrl } from '../lib/gateway-client';
import { useGatewayStore } from '../store/gatewayStore';
import { useGatewayStore, type PluginStatus } from '../store/gatewayStore';
import { toChatAgent, useChatStore } from '../store/chatStore';
import {
Wifi, WifiOff, Bot, BarChart3, Plug, RefreshCw,
@@ -533,7 +533,7 @@ export function RightPanel() {
({pluginStatus.length})
</h3>
<div className="space-y-1 text-xs">
{pluginStatus.map((p: any, i: number) => (
{pluginStatus.map((p: PluginStatus, i: number) => (
<div key={i} className="flex justify-between">
<span className="text-gray-600 truncate">{p.name || p.id}</span>
<span className={p.status === 'active' ? 'text-green-600' : 'text-gray-500'}>