修复网络连接图表 TS 编译错误,使用类型守卫替代不安全的类型断言

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
dushixiangandClaude Opus 4.7 committed 2026-05-06 23:42:46 +08:00
1 parent fe388df67d
commit a6b70e33a9
1 file changed
+3 -1
@@ -61,7 +61,9 @@ export const NetworkConnectionChart = ({agentId, timeRange, start, end, isLive,
});
}
const existing = timeMap.get(point.timestamp)!;
(existing as Record<string, number>)[stateName] = Number(point.value.toFixed(0));
if (stateName === 'established' || stateName === 'time_wait' || stateName === 'close_wait' || stateName === 'listen') {
existing[stateName] = Number(point.value.toFixed(0));
}
});
});