refactor: replace any types with proper TypeScript types across gateway client, hooks, and components
- Add GatewayMessage and JsonPayload interfaces to gateway.ts - Type WebSocket message parsing with GatewayMessage instead of any - Use ReturnType<typeof setTimeout> for timer refs - Type chat event payload destructuring explicitly - Add ChatPayloadMessage interface for extractText() - Replace any casts in loadSessions/loadHistory with typed assertions - Add str() helper in ToolCall.tsx for safe unknown→string extraction - Use Extract<MessageBlock, ...> type guards instead of `as any` casts - Type CodeBlock children prop properly
This commit is contained in:
@@ -11,7 +11,7 @@ export interface ChatMessage {
|
||||
export type MessageBlock =
|
||||
| { type: 'text'; text: string }
|
||||
| { type: 'thinking'; text: string }
|
||||
| { type: 'tool_use'; name: string; input: any; id?: string }
|
||||
| { type: 'tool_use'; name: string; input: Record<string, unknown>; id?: string }
|
||||
| { type: 'tool_result'; content: string; toolUseId?: string; name?: string }
|
||||
| { type: 'image'; mediaType: string; data?: string; url?: string };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user