From 04c9944f2ed1025f5a4ece61761889edd08cc60d Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Wed, 15 Oct 2025 13:19:58 -0500 Subject: [PATCH] fix(arcade): resolve TypeScript errors in game config helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed three TypeScript compilation errors: 1. game-config-helpers.ts:82 - Cast existing.config to object for spread 2. game-config-helpers.ts:116 - Fixed dynamic field assignment in updateGameConfigField 3. MatchingGameValidator.ts:540 - Use proper Difficulty type in MatchingGameConfig Changes: - Import Difficulty and GameType from matching types - Update MatchingGameConfig to use proper union types - Cast existing.config as object before spreading - Rewrite updateGameConfigField to avoid type assertion issue All TypeScript errors resolved. Compilation passes cleanly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- apps/web/src/lib/arcade/game-config-helpers.ts | 7 +++++-- apps/web/src/lib/arcade/game-configs.ts | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/web/src/lib/arcade/game-config-helpers.ts b/apps/web/src/lib/arcade/game-config-helpers.ts index b65a8d6f..ad55f038 100644 --- a/apps/web/src/lib/arcade/game-config-helpers.ts +++ b/apps/web/src/lib/arcade/game-config-helpers.ts @@ -79,7 +79,7 @@ export async function setGameConfig( if (existing) { // Update existing config (merge with existing values) - const mergedConfig = { ...existing.config, ...config } + const mergedConfig = { ...(existing.config as object), ...config } await db .update(schema.roomGameConfigs) .set({ @@ -113,7 +113,10 @@ export async function updateGameConfigField< T extends GameName, K extends keyof GameConfigByName[T], >(roomId: string, gameName: T, field: K, value: GameConfigByName[T][K]): Promise { - await setGameConfig(roomId, gameName, { [field]: value } as Partial) + // Create a partial config with just the field being updated + const partialConfig: Partial = {} as any + ;(partialConfig as any)[field] = value + await setGameConfig(roomId, gameName, partialConfig) } /** diff --git a/apps/web/src/lib/arcade/game-configs.ts b/apps/web/src/lib/arcade/game-configs.ts index 4b67bf1a..d866197c 100644 --- a/apps/web/src/lib/arcade/game-configs.ts +++ b/apps/web/src/lib/arcade/game-configs.ts @@ -10,13 +10,14 @@ */ import type { DifficultyLevel } from '@/app/arcade/memory-quiz/types' +import type { Difficulty, GameType } from '@/app/games/matching/context/types' /** * Configuration for matching (memory pairs) game */ export interface MatchingGameConfig { - gameType: 'abacus-numeral' | 'complement-pairs' - difficulty: number + gameType: GameType + difficulty: Difficulty turnTimer: number }