fix: resolve all TypeScript compilation errors
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m17s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m17s
- Fixed DisciplinesAttunementType enum usage in discipline data files - Fixed EquipmentSlot import in equipment/types.ts - Fixed enchantment-effects.ts export/import chain - Fixed safe-persist.ts StateStorage type compatibility - Fixed store persist partial return types for all stores - Fixed gameStore.ts ElementState type and error handling - Fixed useGameDerived.ts missing properties on GameCoordinatorStore - Added SkillUpgradeChoice type to types.ts - Fixed ActionButtons.tsx optional currentStudyTarget prop - Fixed GameToast.tsx Toast type compatibility - Fixed EnchantmentDesigner sub-component type mismatches - Fixed SpireCombatPage equippedInstances/equipmentInstances types - Fixed page.tsx computeClickMana argument - Added baseCastTime to SpellDef type - Fixed golem/types.ts and loot-drops.ts import paths - Fixed craftingStore.ts missing lastError in initial state and actions - Fixed store-actions-combat-prestige.test.ts Memory type usage - Fixed floor-utils.upgraded.test.ts array type annotation - Fixed computed-stats.test.ts state type assertions - Fixed activity-log.test.ts state type annotation - Fixed discipline-math.test.ts enum value usage - Fixed game-loop.test.ts vitest mock import - Various other test file type fixes
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
// Helper to generate the starting equipment instances for new games.
|
||||
|
||||
import * as CraftingUtils from '../crafting-utils';
|
||||
import type { EquipmentInstance } from '../types';
|
||||
|
||||
export function createInitialEquipmentInstances() {
|
||||
const staffId = CraftingUtils.generateInstanceId();
|
||||
const staffInstance = {
|
||||
const staffInstance: EquipmentInstance = {
|
||||
instanceId: staffId,
|
||||
typeId: 'basicStaff',
|
||||
name: 'Basic Staff',
|
||||
@@ -15,10 +16,14 @@ export function createInitialEquipmentInstances() {
|
||||
rarity: 'common',
|
||||
quality: 100,
|
||||
tags: [],
|
||||
weaponMana: 0,
|
||||
weaponManaMax: 0,
|
||||
weaponManaRegen: 0,
|
||||
weaponManaType: 'raw',
|
||||
};
|
||||
|
||||
const shirtId = CraftingUtils.generateInstanceId();
|
||||
const shirtInstance = {
|
||||
const shirtInstance: EquipmentInstance = {
|
||||
instanceId: shirtId,
|
||||
typeId: 'civilianShirt',
|
||||
name: 'Civilian Shirt',
|
||||
@@ -31,7 +36,7 @@ export function createInitialEquipmentInstances() {
|
||||
};
|
||||
|
||||
const shoesId = CraftingUtils.generateInstanceId();
|
||||
const shoesInstance = {
|
||||
const shoesInstance: EquipmentInstance = {
|
||||
instanceId: shoesId,
|
||||
typeId: 'civilianShoes',
|
||||
name: 'Civilian Shoes',
|
||||
@@ -48,7 +53,7 @@ export function createInitialEquipmentInstances() {
|
||||
[staffId]: staffInstance,
|
||||
[shirtId]: shirtInstance,
|
||||
[shoesId]: shoesInstance,
|
||||
} as Record<string, typeof staffInstance>,
|
||||
} as Record<string, EquipmentInstance>,
|
||||
equippedInstances: {
|
||||
mainHand: staffId,
|
||||
offHand: null,
|
||||
|
||||
@@ -45,6 +45,7 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
selectedDesign: null,
|
||||
selectedEquipmentInstance: null,
|
||||
},
|
||||
lastError: null,
|
||||
|
||||
// Actions
|
||||
setDesignProgress: (progress) => set({ designProgress: progress }),
|
||||
@@ -336,6 +337,8 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
unequipItemAction(slot, set);
|
||||
},
|
||||
|
||||
clearLastError: () => set({ lastError: null }),
|
||||
|
||||
unlockEffects: (effectIds: string[]) => {
|
||||
set((state) => {
|
||||
const existing = new Set(state.unlockedEffects);
|
||||
@@ -367,6 +370,7 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
equippedInstances: state.equippedInstances,
|
||||
lootInventory: state.lootInventory,
|
||||
enchantmentSelection: state.enchantmentSelection,
|
||||
lastError: state.lastError,
|
||||
}),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -3,6 +3,7 @@ import { create } from 'zustand';
|
||||
import { persist } from 'zustand/middleware';
|
||||
import { createSafeStorage } from '../utils/safe-persist';
|
||||
import type { DisciplineState } from '../types/disciplines';
|
||||
import type { ElementState } from '../types';
|
||||
import {
|
||||
calculateManaDrain,
|
||||
calculateStatBonus,
|
||||
@@ -40,9 +41,9 @@ export interface DisciplineStoreState {
|
||||
export interface DisciplineStoreActions {
|
||||
activate: (id: string, gameState?: { elements?: Record<string, { unlocked?: boolean }> }) => void;
|
||||
deactivate: (id: string) => void;
|
||||
processTick: (mana: { rawMana: number; elements: Record<string, { current: number }> }) => {
|
||||
processTick: (mana: { rawMana: number; elements: Record<string, ElementState> }) => {
|
||||
rawMana: number;
|
||||
elements: Record<string, { current: number }>;
|
||||
elements: Record<string, ElementState>;
|
||||
unlockedEffects: string[];
|
||||
};
|
||||
}
|
||||
@@ -170,6 +171,6 @@ export const useDisciplineStore = create<DisciplineStore>()(
|
||||
return { rawMana, elements, unlockedEffects: newUnlockedEffects };
|
||||
},
|
||||
}),
|
||||
{ storage: createSafeStorage(), name: 'mana-loop-discipline-store' }
|
||||
{ storage: createSafeStorage(), name: 'mana-loop-discipline-store', partialize: (state) => ({ disciplines: state.disciplines, activeIds: state.activeIds, concurrentLimit: state.concurrentLimit, totalXP: state.totalXP, processedPerks: state.processedPerks }) }
|
||||
)
|
||||
);
|
||||
@@ -342,10 +342,11 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
||||
setDiscipline: (w) => useDisciplineStore.setState(w),
|
||||
addLogs: (msgs) => msgs.forEach((m) => useUIStore.getState().addLog(m)),
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
// Log error to UI store if available, otherwise console error
|
||||
try {
|
||||
useUIStore.getState().addLog(`⚠️ Tick error: ${error.message}`);
|
||||
const msg = error instanceof Error ? error.message : String(error);
|
||||
useUIStore.getState().addLog(`⚠️ Tick error: ${msg}`);
|
||||
} catch {
|
||||
console.error('Tick error:', error);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,6 @@ export const useUIStore = create<UIState>()(
|
||||
});
|
||||
},
|
||||
}),
|
||||
{ storage: createSafeStorage(), name: 'mana-loop-ui-storage' }
|
||||
{ storage: createSafeStorage(), name: 'mana-loop-ui-storage', partialize: (state) => ({ logs: state.logs, paused: state.paused, gameOver: state.gameOver, victory: state.victory }) }
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user