fix: Duplicate EnchantmentEffectDef types with incompatible shapes #37

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

Severity: Major

Files:

  • src/lib/game/data/enchantment-types.ts (lines 7-21) — canonical EnchantmentEffectDef with typed effect.type: 'spell' | 'bonus' | 'multiplier' | 'special'
  • src/lib/game/data/enchantments/spell-effects/types.ts (lines 5-18) — duplicate with effect.type: string (untyped) and category: string (untyped)

Problem: The spell-effects subdirectory has its own copy of EnchantmentEffectDef with looser typing. The spell-effects/index.ts re-exports EnchantmentEffectDef from ./types, which is a different type than the one in enchantment-types.ts. This means spell effect objects may not be assignable to the EnchantmentEffectDef expected by enchantments/index.ts functions.

Impact: Type incompatibility between spell effects and the rest of the enchantment system. Could cause runtime errors or silent data issues.

Fix: Remove the duplicate from spell-effects/types.ts and import from enchantment-types.ts instead.

**Severity:** Major **Files:** - `src/lib/game/data/enchantment-types.ts` (lines 7-21) — canonical `EnchantmentEffectDef` with typed `effect.type: 'spell' | 'bonus' | 'multiplier' | 'special'` - `src/lib/game/data/enchantments/spell-effects/types.ts` (lines 5-18) — duplicate with `effect.type: string` (untyped) and `category: string` (untyped) **Problem:** The spell-effects subdirectory has its own copy of `EnchantmentEffectDef` with looser typing. The `spell-effects/index.ts` re-exports `EnchantmentEffectDef` from `./types`, which is a different type than the one in `enchantment-types.ts`. This means spell effect objects may not be assignable to the `EnchantmentEffectDef` expected by `enchantments/index.ts` functions. **Impact:** Type incompatibility between spell effects and the rest of the enchantment system. Could cause runtime errors or silent data issues. **Fix:** Remove the duplicate from `spell-effects/types.ts` and import from `enchantment-types.ts` instead.
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 — Duplicate EnchantmentEffectDef types with incompatible shapes.

[priority: 3] DATA/LOGIC BUG — Duplicate EnchantmentEffectDef types with incompatible shapes.
Author
Owner

Starting work on #37. Will remove duplicate EnchantmentEffectDef from spell-effects/types.ts and import from enchantment-types.ts.

Starting work on #37. Will remove duplicate EnchantmentEffectDef from spell-effects/types.ts and import from enchantment-types.ts.
Author
Owner

Fixed. Removed duplicate EnchantmentEffectDef from spell-effects/types.ts and replaced it with a re-export from the canonical enchantment-types.ts. Updated spell-effects/index.ts accordingly. Fixed ALL_CASTER to use EquipmentCategory[] type instead of string[].

Fixed. Removed duplicate EnchantmentEffectDef from spell-effects/types.ts and replaced it with a re-export from the canonical enchantment-types.ts. Updated spell-effects/index.ts accordingly. Fixed ALL_CASTER to use EquipmentCategory[] type instead of string[].
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#37