fix: EquipmentSlot type defined differently in two places #38

Closed
opened 2026-05-18 15:59:27 +02:00 by Anexim · 3 comments
Owner

Severity: Major

Files:

  • src/lib/game/types/equipmentSlot.tsEquipmentSlot with "mainHand" | "offHand" | "head" | "body" | "hands" | "accessory" | "accessory1" | "accessory2" (7 values, includes bare "accessory")
  • src/lib/game/data/equipment/types.tsEquipmentSlot with '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.ts has 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 feet slot won't type-check against the types/equipmentSlot.ts definition.

Fix: Consolidate into a single EquipmentSlot type in types/equipmentSlot.ts that includes all valid slots: 'mainHand' | 'offHand' | 'head' | 'body' | 'hands' | 'feet' | 'accessory1' | 'accessory2'. Import this type everywhere instead of redefining it.

**Severity:** Major **Files:** - `src/lib/game/types/equipmentSlot.ts` — `EquipmentSlot` with `"mainHand" | "offHand" | "head" | "body" | "hands" | "accessory" | "accessory1" | "accessory2"` (7 values, includes bare `"accessory"`) - `src/lib/game/data/equipment/types.ts` — `EquipmentSlot` with `'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.ts` has 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 `feet` slot won't type-check against the types/equipmentSlot.ts definition. **Fix:** Consolidate into a single `EquipmentSlot` type in `types/equipmentSlot.ts` that includes all valid slots: `'mainHand' | 'offHand' | 'head' | 'body' | 'hands' | 'feet' | 'accessory1' | 'accessory2'`. Import this type everywhere instead of redefining it.
Anexim added the ai:todo label 2026-05-18 15:59:27 +02:00
n8n-gitea was assigned by Anexim 2026-05-18 15:59:27 +02:00
Author
Owner

[priority: 3] DATA/LOGIC BUG — EquipmentSlot type defined differently in two places.

[priority: 3] DATA/LOGIC BUG — EquipmentSlot type defined differently in two places.
Author
Owner

Starting work on #38. Will consolidate EquipmentSlot type into a single definition.

Starting work on #38. Will consolidate EquipmentSlot type into a single definition.
Author
Owner

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.

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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#38