From c0e015e6e5faba2901427a986601b20087b8992c Mon Sep 17 00:00:00 2001 From: root Date: Mon, 9 Mar 2026 17:23:48 +0000 Subject: [PATCH] fix(client): resolve three TypeScript type errors Add missing Vite client type declarations, fix canvas-to-HTMLImageElement cast in CharacterCompositor, and use proper Stats/StatName types in NpcInfoPanel instead of loose Record. Co-Authored-By: Claude Opus 4.6 --- client/src/sprites/CharacterCompositor.ts | 2 +- client/src/ui/NpcInfoPanel.ts | 6 +++--- client/src/vite-env.d.ts | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 client/src/vite-env.d.ts diff --git a/client/src/sprites/CharacterCompositor.ts b/client/src/sprites/CharacterCompositor.ts index 1732391..a7aa0e1 100644 --- a/client/src/sprites/CharacterCompositor.ts +++ b/client/src/sprites/CharacterCompositor.ts @@ -87,7 +87,7 @@ export class CharacterCompositor { } // Add composited texture to Phaser - this.scene.textures.addSpriteSheet(key, canvas, { + this.scene.textures.addSpriteSheet(key, canvas as unknown as HTMLImageElement, { frameWidth: SPRITE_FRAME_WIDTH, frameHeight: SPRITE_FRAME_HEIGHT, }); diff --git a/client/src/ui/NpcInfoPanel.ts b/client/src/ui/NpcInfoPanel.ts index 6ef8f53..db31f3b 100644 --- a/client/src/ui/NpcInfoPanel.ts +++ b/client/src/ui/NpcInfoPanel.ts @@ -1,4 +1,4 @@ -import type { EntityState, NarrationEvent, MemoryEvent } from '@dflike/shared'; +import type { EntityState, NarrationEvent, MemoryEvent, Stats, StatName } from '@dflike/shared'; const ACTIVITY_LABELS: Record = { wander: 'Wandering', @@ -630,10 +630,10 @@ export class NpcInfoPanel { } } - private updateStats(stats: Record): void { + private updateStats(stats: Stats): void { const physicalKeys = ['STR', 'DEX', 'CON', 'INT', 'PER']; const personalityKeys = ['SOC', 'COU', 'CUR', 'EMP', 'TMP']; - const mapping: Record = { + const mapping: Record = { STR: 'strength', DEX: 'dexterity', CON: 'constitution', INT: 'intelligence', PER: 'perception', SOC: 'sociability', COU: 'courage', CUR: 'curiosity', EMP: 'empathy', TMP: 'temperament', }; diff --git a/client/src/vite-env.d.ts b/client/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/client/src/vite-env.d.ts @@ -0,0 +1 @@ +///