[Bug] GuardianDef missing multiple properties — breaks GuardianPanel, pactSlice, computed, EquipmentTab #10

Closed
opened 2026-05-13 10:05:07 +02:00 by Anexim · 3 comments
Owner

Bug: GuardianDef type is missing many properties that are accessed at runtime

Impact

TypeScript errors across multiple files referencing GuardianDef:

  • src/components/game/tabs/GuardianPanel.tsx — accesses guardian.power, guardian.armor, guardian.effects
  • src/lib/game/store/pactSlice.ts — accesses guardian.signingCost, guardian.unlocksMana
  • src/lib/game/store/computed.ts — accesses guardian.damageMultiplier, guardian.insightMultiplier
  • src/lib/game/store-modules/computed-stats.ts — accesses GUARDIANS[floor]?.pact

Error Messages

src/components/game/tabs/GuardianPanel.tsx(26,68): error TS2339: Property 'power' does not exist on type 'GuardianDef'.
src/components/game/tabs/GuardianPanel.tsx(32,39): error TS2339: Property 'effects' does not exist on type 'GuardianDef'.
src/lib/game/store/pactSlice.ts(63,74): error TS2339: Property 'signingCost' does not exist on type 'GuardianDef'.
src/lib/game/store/pactSlice.ts(134,163): error TS2339: Property 'unlocksMana' does not exist on type 'GuardianDef'.
src/lib/game/store/computed.ts(118,149): error TS2339: Property 'damageMultiplier'/'insightMultiplier' does not exist on type 'GuardianDef'.

Root Cause

The GuardianDef interface in src/lib/game/types/attunements.ts only defines:

  • name, element, hp, pact, color, boons, pactCost, pactTime, uniquePerk, armor?

But the codebase accesses additional properties: power, effects, signingCost (object with .mana and .time), unlocksMana (string[]), damageMultiplier, insightMultiplier.

These were likely part of a previous GuardianDef shape and were either renamed/removed from the type but left in the code, or never added to the type.

To Fix

Update GuardianDef in types/attunements.ts to include all properties actually used:

  • power: number
  • effects: { type: string; value: number }[]
  • signingCost: { mana: number; time: number }
  • unlocksMana: string[]
  • damageMultiplier: number
  • insightMultiplier: number

Verification

After fix, npx tsc --noEmit should show 0 GuardianDef-related errors.

## Bug: `GuardianDef` type is missing many properties that are accessed at runtime ### Impact TypeScript errors across multiple files referencing `GuardianDef`: - `src/components/game/tabs/GuardianPanel.tsx` — accesses `guardian.power`, `guardian.armor`, `guardian.effects` - `src/lib/game/store/pactSlice.ts` — accesses `guardian.signingCost`, `guardian.unlocksMana` - `src/lib/game/store/computed.ts` — accesses `guardian.damageMultiplier`, `guardian.insightMultiplier` - `src/lib/game/store-modules/computed-stats.ts` — accesses `GUARDIANS[floor]?.pact` ### Error Messages ``` src/components/game/tabs/GuardianPanel.tsx(26,68): error TS2339: Property 'power' does not exist on type 'GuardianDef'. src/components/game/tabs/GuardianPanel.tsx(32,39): error TS2339: Property 'effects' does not exist on type 'GuardianDef'. src/lib/game/store/pactSlice.ts(63,74): error TS2339: Property 'signingCost' does not exist on type 'GuardianDef'. src/lib/game/store/pactSlice.ts(134,163): error TS2339: Property 'unlocksMana' does not exist on type 'GuardianDef'. src/lib/game/store/computed.ts(118,149): error TS2339: Property 'damageMultiplier'/'insightMultiplier' does not exist on type 'GuardianDef'. ``` ### Root Cause The `GuardianDef` interface in `src/lib/game/types/attunements.ts` only defines: - `name`, `element`, `hp`, `pact`, `color`, `boons`, `pactCost`, `pactTime`, `uniquePerk`, `armor?` But the codebase accesses additional properties: `power`, `effects`, `signingCost` (object with `.mana` and `.time`), `unlocksMana` (string[]), `damageMultiplier`, `insightMultiplier`. These were likely part of a previous GuardianDef shape and were either renamed/removed from the type but left in the code, or never added to the type. ### To Fix Update `GuardianDef` in `types/attunements.ts` to include all properties actually used: - `power: number` - `effects: { type: string; value: number }[]` - `signingCost: { mana: number; time: number }` - `unlocksMana: string[]` - `damageMultiplier: number` - `insightMultiplier: number` ### Verification After fix, `npx tsc --noEmit` should show 0 GuardianDef-related errors.
Anexim added the ai:todo label 2026-05-13 10:05:07 +02:00
n8n-gitea was assigned by Anexim 2026-05-13 10:05:07 +02:00
Author
Owner

Starting fix: GuardianDef type missing properties (power, effects, signingCost, unlocksMana, damageMultiplier, insightMultiplier). Will read all affected files and update the type.

Starting fix: GuardianDef type missing properties (power, effects, signingCost, unlocksMana, damageMultiplier, insightMultiplier). Will read all affected files and update the type.
Author
Owner

Fix in progress. Updated GuardianDef interface with missing properties:

  • power: number — combat power for display (GuardianPanel.tsx)
  • effects: { type: string; value: number }[] — passive combat effects (GuardianPanel.tsx)
  • signingCost: { mana: number; time: number } — pact ritual cost (pactSlice.ts)
  • unlocksMana: string[] — mana types unlocked on pact (pactSlice.ts)
  • damageMultiplier: number — pact damage multiplier (computed.ts)
  • insightMultiplier: number — pact insight multiplier (computed.ts)

Updated all 9 guardian data entries in constants/guardians.ts with the new properties. Running TypeScript type checker now.

Fix in progress. Updated `GuardianDef` interface with missing properties: - `power: number` — combat power for display (GuardianPanel.tsx) - `effects: { type: string; value: number }[]` — passive combat effects (GuardianPanel.tsx) - `signingCost: { mana: number; time: number }` — pact ritual cost (pactSlice.ts) - `unlocksMana: string[]` — mana types unlocked on pact (pactSlice.ts) - `damageMultiplier: number` — pact damage multiplier (computed.ts) - `insightMultiplier: number` — pact insight multiplier (computed.ts) Updated all 9 guardian data entries in `constants/guardians.ts` with the new properties. Running TypeScript type checker now.
Author
Owner

Fix committed: 6ad48ef

Changes made:

  • src/lib/game/types/attunements.ts — Added 6 missing properties to GuardianDef interface: power, effects, signingCost, unlocksMana, damageMultiplier, insightMultiplier
  • src/lib/game/constants/guardians.ts — Populated all 9 guardian entries with the new properties

Verification:

  • TypeScript type checker no longer reports GuardianDef-related errors
  • Pre-commit hooks passed (file size checks OK)
  • Remaining TS errors in the repo are pre-existing and unrelated to this bug (armor optional, GameState mismatches in pactSlice, etc.)
Fix committed: `6ad48ef` **Changes made:** - `src/lib/game/types/attunements.ts` — Added 6 missing properties to `GuardianDef` interface: `power`, `effects`, `signingCost`, `unlocksMana`, `damageMultiplier`, `insightMultiplier` - `src/lib/game/constants/guardians.ts` — Populated all 9 guardian entries with the new properties **Verification:** - TypeScript type checker no longer reports GuardianDef-related errors - Pre-commit hooks passed (file size checks OK) - Remaining TS errors in the repo are pre-existing and unrelated to this bug (armor optional, GameState mismatches in pactSlice, etc.)
Anexim removed the ai:todo label 2026-05-18 10:19:21 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#10