{epic.name}
+{epic.description}
++ Created {formatDate(epic.createdAt)} +
+{epic.description}
+
+
+// ✅ 提供描述性 alt
+
+
+// ❌ 颜色作为唯一指示
+Error
+
+// ✅ 添加图标和文本
+
+ {(issue as any).description}
+)} +``` + +3. **SignalR Event Handlers** (`lib/hooks/useProjectHub.ts`): +```typescript +// ❌ Lines 32-142 (15+ occurrences) +manager.on('ProjectCreated', (data: any) => { + console.log('Project created:', data); +}); + +manager.on('EpicUpdated', (data: any) => { + console.log('Epic updated:', data); +}); +``` + +4. **React Query Error Handlers** (Multiple hooks): +```typescript +// ❌ use-epics.ts, use-stories.ts, use-tasks.ts +onError: (error: any) => { + console.error('Failed to create epic:', error); + toast.error(error?.response?.data?.message || 'Failed to create epic'); +}, +``` + +5. **Form Default Values** (Multiple forms): +```typescript +// ❌ epic-form.tsx, story-form.tsx, task-form.tsx +estimatedHours: epic?.estimatedHours || ('' as any), // Type coercion abuse +``` + +#### Impact + +- **Runtime Errors**: Properties and methods can fail at runtime without compile-time warnings +- **No IntelliSense**: Developers lose auto-completion and type hints +- **Refactoring Risk**: Changes to types won't be caught, making refactoring dangerous +- **Security Risk**: Unvalidated data can be passed through without type checking + +#### Recommended Fix + +**1. Define proper event types for SignalR:** + +```typescript +// ✅ lib/signalr/types.ts +export interface ProjectCreatedEvent { + projectId: string; + name: string; + key: string; + createdBy: string; + tenantId: string; + timestamp: string; +} + +export interface EpicUpdatedEvent { + epicId: string; + projectId: string; + name: string; + status: WorkItemStatus; + priority: WorkItemPriority; + timestamp: string; +} + +// Union type for all events +export type SignalREvent = + | ProjectCreatedEvent + | EpicUpdatedEvent + | StoryCreatedEvent + | TaskUpdatedEvent; +``` + +**2. Fix API client types:** + +```typescript +// ✅ lib/api/client.ts +import { AxiosRequestConfig } from 'axios'; + +export const api = { + get: async+ {this.state.error?.message} +
+ +