Problem. ChatItem.meta is any (page.tsx:148), generatedFiles/restoredFiles are any[] (page.tsx:226, 1036), the SSE handler casts event.data as any then reads dozens of untyped fields (page.tsx:332, 553, 608, 655, 665, 688), and ChartTooltip props are any (MetricsTab.tsx:185, 193).
Why it matters. This defeats the type system exactly where malformed backend payloads are most likely.
Suggested fix. Define a discriminated union SSEEvent ({ type: 'metric'; data: MetricEvent } | …) in src/lib/types.ts and narrow on event.type; type meta per ChatItem.type.
Problem.
ChatItem.metaisany(page.tsx:148),generatedFiles/restoredFilesareany[](page.tsx:226, 1036), the SSE handler castsevent.data as anythen reads dozens of untyped fields (page.tsx:332, 553, 608, 655, 665, 688), andChartTooltipprops areany(MetricsTab.tsx:185, 193).Why it matters. This defeats the type system exactly where malformed backend payloads are most likely.
Suggested fix. Define a discriminated union
SSEEvent({ type: 'metric'; data: MetricEvent } | …) insrc/lib/types.tsand narrow onevent.type; typemetaperChatItem.type.