CLAUDE: Fix TypeScript error in DefensiveSetup - use on_first/on_second/on_third

Fixed property access bug introduced in previous commit:

**Issue**:
- DefensiveSetup.vue was accessing `gameState.runners.third` and `runners.first/second/third`
- GameState type doesn't have a `runners` property
- Caused TypeScript error: "Property 'runners' does not exist on type 'GameState'"

**Fix**:
- Changed to use correct properties: `on_first`, `on_second`, `on_third`
- Updated infieldDepthOptions: `props.gameState?.on_third` (line 163)
- Updated outfieldDepthOptions: destructure `on_first, on_second, on_third` (line 178)
- Updated hasRunners check: `on_first || on_second || on_third` (line 184)

**Why**:
GameState uses individual nullable properties for runners, not a nested object.
This matches the backend Pydantic model structure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2025-11-21 15:44:20 -06:00
parent f3eb5e8200
commit 1f2daf233e

View File

@ -160,7 +160,7 @@ const infieldDepthOptions = computed<ButtonGroupOption[]>(() => {
]
// Only show infield_in and corners_in if runner on third
if (props.gameState?.runners?.third) {
if (props.gameState?.on_third) {
options.push({ value: 'infield_in', label: 'Infield In', icon: '⬆️' })
options.push({ value: 'corners_in', label: 'Corners In', icon: '◀️▶️' })
}
@ -175,13 +175,13 @@ const outfieldDepthOptions = computed<ButtonGroupOption[]>(() => {
// Check for walk-off scenario
if (props.gameState) {
const { inning, half, home_score, away_score, runners } = props.gameState
const { inning, half, home_score, away_score, on_first, on_second, on_third } = props.gameState
const isHomeBatting = half === 'bottom'
const isLateInning = inning >= 9
const isCloseGame = isHomeBatting
? home_score <= away_score
: away_score <= home_score
const hasRunners = runners?.first || runners?.second || runners?.third
const hasRunners = on_first || on_second || on_third
// Only show shallow in walk-off situations
if (isHomeBatting && isLateInning && isCloseGame && hasRunners) {