fix: Duplicate EnchantmentEffectDef types with incompatible shapes #37
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/data/enchantment-types.ts(lines 7-21) — canonicalEnchantmentEffectDefwith typedeffect.type: 'spell' | 'bonus' | 'multiplier' | 'special'src/lib/game/data/enchantments/spell-effects/types.ts(lines 5-18) — duplicate witheffect.type: string(untyped) andcategory: string(untyped)Problem: The spell-effects subdirectory has its own copy of
EnchantmentEffectDefwith looser typing. Thespell-effects/index.tsre-exportsEnchantmentEffectDeffrom./types, which is a different type than the one inenchantment-types.ts. This means spell effect objects may not be assignable to theEnchantmentEffectDefexpected byenchantments/index.tsfunctions.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.tsand import fromenchantment-types.tsinstead.[priority: 3] DATA/LOGIC BUG — Duplicate EnchantmentEffectDef types with incompatible shapes.
Starting work on #37. Will remove duplicate EnchantmentEffectDef from spell-effects/types.ts and import from enchantment-types.ts.
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[].