refactor: extract shared FightData interface to fight/types.ts

Move FightData, FightRound, FightBot, FightArenaInfo types from local
definitions in FightViewer.vue to shared fight/types.ts. Replace `any`
typing in HumanFightPage, FightPage, useFightPolling, and useFightCache
with proper typed interfaces. Fix null-safety guards exposed by typing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 06:19:26 +00:00
co-authored by Claude Opus 4.6
parent 2f7c10e4b8
commit 945a776a5a
6 changed files with 81 additions and 48 deletions
+7 -5
View File
@@ -1,4 +1,5 @@
import { ref, type Ref } from 'vue'
import type { FightData, FightBot, FightArenaInfo } from '../game/fight/types'
export interface LiveLogItem {
type: string
@@ -8,11 +9,12 @@ export interface LiveLogItem {
}
export interface LiveFightData {
botA: any
botB: any
botA: FightBot | null
botB: FightBot | null
arena: string
arenaInfo?: { name: string }
[key: string]: any
arenaInfo?: FightArenaInfo | null
mode?: string
potSats?: number
}
interface SSEListenerEntry {
@@ -25,7 +27,7 @@ export function useFightPolling(fightId: Ref<string>) {
const isLoading = ref(true)
const liveRounds = ref(0)
const fightError = ref('')
const fight = ref<any>(null)
const fight = ref<FightData | null>(null)
const liveFightData = ref<LiveFightData | null>(null)
const spectatorCount = ref(0)
const currentChallengeInfo = ref<{ type: string; label: string } | null>(null)