fix: EquipmentSlot type defined differently in two places #38
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Major
Files:
src/lib/game/types/equipmentSlot.ts—EquipmentSlotwith"mainHand" | "offHand" | "head" | "body" | "hands" | "accessory" | "accessory1" | "accessory2"(7 values, includes bare"accessory")src/lib/game/data/equipment/types.ts—EquipmentSlotwith'mainHand' | 'offHand' | 'head' | 'body' | 'hands' | 'feet' | 'accessory1' | 'accessory2'(8 values, has'feet'but no bare'accessory')Problem: The types version has
"accessory"but not"feet", while the data version has"feet"but not"accessory". These are mutually incompatible. Additionally,types/equipment.tshas a third variation:slot: 'mainHand' | 'offHand' | 'head' | 'body' | 'hands' | 'accessory'.Impact: Type mismatches when equipment data flows between the data layer and the type system. Equipment with
feetslot won't type-check against the types/equipmentSlot.ts definition.Fix: Consolidate into a single
EquipmentSlottype intypes/equipmentSlot.tsthat includes all valid slots:'mainHand' | 'offHand' | 'head' | 'body' | 'hands' | 'feet' | 'accessory1' | 'accessory2'. Import this type everywhere instead of redefining it.[priority: 3] DATA/LOGIC BUG — EquipmentSlot type defined differently in two places.
Starting work on #38. Will consolidate EquipmentSlot type into a single definition.
Fixed. Updated types/equipmentSlot.ts to be the canonical EquipmentSlot type with all 8 slots (mainHand, offHand, head, body, hands, feet, accessory1, accessory2). Updated equipment/types.ts to import from types/equipmentSlot instead of redefining. Updated types/equipment.ts legacy EquipmentDef to use the canonical type. Fixed types/index.ts to properly re-export EquipmentSlot from equipmentSlot and LootInventory from equipment.