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<string, number>.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-03-09 17:23:48 +00:00
parent e32f121fc9
commit c0e015e6e5
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -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,
});
+3 -3
View File
@@ -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<string, string> = {
wander: 'Wandering',
@@ -630,10 +630,10 @@ export class NpcInfoPanel {
}
}
private updateStats(stats: Record<string, number>): void {
private updateStats(stats: Stats): void {
const physicalKeys = ['STR', 'DEX', 'CON', 'INT', 'PER'];
const personalityKeys = ['SOC', 'COU', 'CUR', 'EMP', 'TMP'];
const mapping: Record<string, string> = {
const mapping: Record<string, StatName> = {
STR: 'strength', DEX: 'dexterity', CON: 'constitution', INT: 'intelligence', PER: 'perception',
SOC: 'sociability', COU: 'courage', CUR: 'curiosity', EMP: 'empathy', TMP: 'temperament',
};
+1
View File
@@ -0,0 +1 @@
/// <reference types="vite/client" />