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:
@@ -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,
|
||||
});
|
||||
|
||||
@@ -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',
|
||||
};
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
Reference in New Issue
Block a user