From 3169995d7fe4d4803140ecd2acd87166d6fb5d5f Mon Sep 17 00:00:00 2001 From: "claude (blind_chess)" Date: Mon, 18 May 2026 20:14:26 -0400 Subject: [PATCH] refactor(server): type captureTally accumulators as PieceTally Tighten the local byYou/byOpponent accumulators from the wider Record to PieceTally, matching the return type's fields and preventing silent invalid-key writes. Co-Authored-By: Claude Opus 4.7 (1M context) --- packages/server/src/captures.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/server/src/captures.ts b/packages/server/src/captures.ts index 0564675..4bab16a 100644 --- a/packages/server/src/captures.ts +++ b/packages/server/src/captures.ts @@ -1,4 +1,4 @@ -import type { CaptureTally, Color } from '@blind-chess/shared'; +import type { CaptureTally, Color, PieceTally } from '@blind-chess/shared'; import type { Game } from './state.js'; /** @@ -8,8 +8,8 @@ import type { Game } from './state.js'; * no live board state, no opponent positions. */ export function captureTally(game: Game, viewer: Color): CaptureTally { - const byYou: Record = {}; - const byOpponent: Record = {}; + const byYou: PieceTally = {}; + const byOpponent: PieceTally = {}; for (const rec of game.moveHistory) { const captured = rec.capturedPieceType; if (!captured) continue;