Open source personal finance application
fix: resolve all 395 TypeScript errors across the codebase
Ilya Komichevbb4873c7cd93
diff --git a/app/components/amount/getTotal.test.ts b/app/components/amount/getTotal.test.tsindex 68249b55..d5ef20be 100644--- a/app/components/amount/getTotal.test.ts+++ b/app/components/amount/getTotal.test.ts@@ -194,8 +194,8 @@ describe('getWalletsTotals', () => {it('computes wallet balance from income and expense', () => {const totals = getWalletsTotals({trnsItems: {- t1: trnsItems.transactionIncomeWalletCashUSD1000,- t2: trnsItems.transactionExpenseWalletCashUSD400,+ t1: trnsItems.transactionIncomeWalletCashUSD1000!,+ t2: trnsItems.transactionExpenseWalletCashUSD400!,},walletsItems,})@@ -206,7 +206,7 @@ describe('getWalletsTotals', () => {it('handles transfers — adds to income wallet, subtracts from expense wallet', () => {const totals = getWalletsTotals({trnsItems: {- t1: trnsItems.transferExpenseWalletCashUSD10IncomeWalletRUB700,+ t1: trnsItems.transferExpenseWalletCashUSD10IncomeWalletRUB700!,},walletsItems,})@@ -218,8 +218,8 @@ describe('getWalletsTotals', () => {it('handles adjustments as income/expense on wallet', () => {const totals = getWalletsTotals({trnsItems: {- t1: trnsItems.adjustmentIncomeWalletCashUSD200,- t2: trnsItems.adjustmentExpenseWalletCashUSD50,+ t1: trnsItems.adjustmentIncomeWalletCashUSD200!,+ t2: trnsItems.adjustmentExpenseWalletCashUSD50!,},walletsItems,})@@ -230,12 +230,12 @@ describe('getWalletsTotals', () => {it('computes full balance for walletCashUSD with mixed trns', () => {const totals = getWalletsTotals({trnsItems: {- t1: trnsItems.transactionIncomeWalletCashUSD1000,- t2: trnsItems.transactionExpenseWalletCashUSD400,- t3: trnsItems.transferExpenseWalletCashUSD10IncomeWalletRUB700,- t4: trnsItems.transferExpenseWalletCreditUSD40IncomeWalletCashUSD40,- t5: trnsItems.adjustmentIncomeWalletCashUSD30,- t6: trnsItems.adjustmentExpenseWalletCashUSD30,+ t1: trnsItems.transactionIncomeWalletCashUSD1000!,+ t2: trnsItems.transactionExpenseWalletCashUSD400!,+ t3: trnsItems.transferExpenseWalletCashUSD10IncomeWalletRUB700!,+ t4: trnsItems.transferExpenseWalletCreditUSD40IncomeWalletCashUSD40!,+ t5: trnsItems.adjustmentIncomeWalletCashUSD30!,+ t6: trnsItems.adjustmentExpenseWalletCashUSD30!,},walletsItems,})@@ -251,7 +251,7 @@ describe('getWalletsTotals', () => {baseCurrencyCode: 'USD',rates,trnsItems: {- t1: trnsItems.transactionIncomeWalletOneRUB700,+ t1: trnsItems.transactionIncomeWalletOneRUB700!,},walletsItems,})diff --git a/app/components/app/useInitApp.ts b/app/components/app/useInitApp.tsindex 2b129c49..af01b562 100644--- a/app/components/app/useInitApp.ts+++ b/app/components/app/useInitApp.ts@@ -1,6 +1,11 @@import localforage from 'localforage'+import type { Categories } from '~/components/categories/types'+import type { Rates } from '~/components/currencies/types'import type { LocaleSlug } from '~/components/locale/types'+import type { Trns } from '~/components/trns/types'+import type { User } from '~/components/user/useUserStore'+import type { Wallets } from '~/components/wallets/types'import { useCategoriesStore } from '~/components/categories/useCategoriesStore'import { useCurrenciesStore } from '~/components/currencies/useCurrenciesStore'@@ -35,23 +40,24 @@ export function useInitApp() {async function loadDataFromCache() {const [user, userSettings, currencies, categories, wallets, trns] = await Promise.all([- localforage.getItem(STORAGE_KEYS.user),+ localforage.getItem<User | null>(STORAGE_KEYS.user),localforage.getItem<{ baseCurrency?: string, locale?: LocaleSlug }>(STORAGE_KEYS.userSettings),- localforage.getItem(STORAGE_KEYS.currencies),- localforage.getItem(STORAGE_KEYS.categories),- localforage.getItem(STORAGE_KEYS.wallets),- localforage.getItem(STORAGE_KEYS.trns),+ localforage.getItem<{ rates?: Rates }>(STORAGE_KEYS.currencies),+ localforage.getItem<Categories | null>(STORAGE_KEYS.categories),+ localforage.getItem<Wallets | null>(STORAGE_KEYS.wallets),+ localforage.getItem<Trns | null>(STORAGE_KEYS.trns),])- userStore.setUser(user)+ userStore.setUser(user ?? null)if (userSettings?.baseCurrency)userStore.setUserBaseCurrency(userSettings.baseCurrency)if (userSettings?.locale)userStore.setUserLocale(userSettings.locale)- currenciesStore.setRates(currencies?.rates)- walletsStore.setWallets(wallets)- categoriesStore.setCategories(categories)- trnsStore.setTrns(trns)+ if (currencies?.rates)+ currenciesStore.setRates(currencies.rates)+ walletsStore.setWallets(wallets ?? null)+ categoriesStore.setCategories(categories ?? null)+ trnsStore.setTrns(trns ?? null)}function clearLocalData() {diff --git a/app/components/bottomSheet/useBottomSheetDrag.ts b/app/components/bottomSheet/useBottomSheetDrag.tsindex 25046b78..eb31ffd4 100644--- a/app/components/bottomSheet/useBottomSheetDrag.ts+++ b/app/components/bottomSheet/useBottomSheetDrag.ts@@ -19,7 +19,7 @@ type UseBottomSheetDragParams = {function getClientY(event: Event): number {return 'touches' in event- ? Math.round(event.touches[0].clientY)+ ? Math.round(event.touches[0]!.clientY): event.clientY}diff --git a/app/components/categories/CommandPalette.vue b/app/components/categories/CommandPalette.vueindex 4ee9ce37..4fd2db22 100644--- a/app/components/categories/CommandPalette.vue+++ b/app/components/categories/CommandPalette.vue@@ -16,7 +16,7 @@ const { t } = useI18n()const categoriesStore = useCategoriesStore()const cats = computed(() => {- const adjustmentCategory = categoriesStore.items.adjustment+ const adjustmentCategory = categoriesStore.items.adjustment!const adjustmentGroup = {...adjustmentCategory,id: 'adjustment',@@ -55,8 +55,8 @@ const cats = computed(() => {return [adjustmentGroup, ...rootGroups]})-function onSelect(item: CategoryItemWithId) {- emit('selected', item.id)+function onSelect(item: any) {+ emit('selected', (item as CategoryItemWithId).id)if (props.hide)props.hide()}@@ -65,28 +65,28 @@ function onSelect(item: CategoryItemWithId) {<template><UCommandPalette:placeholder="t('categories.search.placeholder')"- :groups="cats"+ :groups="(cats as any)"labelKey="name"@update:modelValue="onSelect">- <template #category="{ item }">+ <template #category="{ item: rawItem }"><UiElement- :isActive="item.id === props.activeItemId"+ :isActive="(rawItem as any).id === props.activeItemId":lineWidth="1"class="w-full grow"insideClasses="min-h-[46px]"><template #leftIcon><UiIconBase- :color="item.color"- :name="item.icon"+ :color="(rawItem as any).color"+ :name="(rawItem as any).icon"invert/></template><div class="grid grow"><CategoriesName- :category="item"+ :category="(rawItem as any)"/></div></UiElement>diff --git a/app/components/categories/Form.vue b/app/components/categories/Form.vueindex 2789595f..00793cec 100644--- a/app/components/categories/Form.vue+++ b/app/components/categories/Form.vue@@ -68,7 +68,8 @@ async function onSave() {}for (const id of Object.keys(categoriesStore.items)) {- if (categoriesStore.items[id].name === parsed.data.name && categoriesStore.items[id].parentId === parsed.data.parentId && id !== editCategoryId) {+ const cat = categoriesStore.items[id]+ if (cat && cat.name === parsed.data.name && cat.parentId === parsed.data.parentId && id !== editCategoryId) {showErrorToast('categories.form.name.exist')return}@@ -190,7 +191,7 @@ async function onSave() {<div><UiTitleModal>{{ t('categories.form.selectColor') }}</UiTitleModal><CategoriesItem- :categoryId="props.categoryId"+ :categoryId="editCategoryId":category="categoryPlaceholder"/></div>@@ -224,7 +225,7 @@ async function onSave() {<div class="grid gap-3 pt-3 pb-1"><UiTitleModal>{{ t('categories.form.selectIcon') }}</UiTitleModal><CategoriesItem- :categoryId="props.categoryId"+ :categoryId="editCategoryId":category="categoryPlaceholder"/></div>diff --git a/app/components/categories/List.vue b/app/components/categories/List.vueindex 23b4ae09..03358d3c 100644--- a/app/components/categories/List.vue+++ b/app/components/categories/List.vue@@ -25,7 +25,7 @@ const categoriesStore = useCategoriesStore()v-for="categoryId in ids":key="categoryId":activeItemId="activeItemId"- :category="categoriesStore.items[categoryId]"+ :category="categoriesStore.items[categoryId]!":categoryId="categoryId":contextMenuItems="props.getContextMenuItems?.(categoryId)":insideClasses="props.insideClasses"diff --git a/app/components/categories/SelectorGrid.vue b/app/components/categories/SelectorGrid.vueindex 7cd4179f..0307a76c 100644--- a/app/components/categories/SelectorGrid.vue+++ b/app/components/categories/SelectorGrid.vue@@ -31,7 +31,7 @@ function select(id: CategoryId) {:activeItemId="props.activeItemId":categoryId="categoryId":class="itemClasses"- :category="categoriesStore.items[categoryId]"+ :category="categoriesStore.items[categoryId]!"isShowParentalt@click="select(categoryId)"diff --git a/app/components/categories/SelectorTree.vue b/app/components/categories/SelectorTree.vueindex 900f0e2b..a0762f2b 100644--- a/app/components/categories/SelectorTree.vue+++ b/app/components/categories/SelectorTree.vue@@ -75,7 +75,7 @@ onMounted(() => {<CategoriesItem:categoryId:lineWidth="4"- :category="categoriesStore.items[categoryId]"+ :category="categoriesStore.items[categoryId]!":activeItemId="props.selectedIds?.includes(categoryId) ? categoryId : null"@click="select(categoryId, false)"@filter.stop="onFilter(categoryId)"@@ -89,7 +89,7 @@ onMounted(() => {v-for="childCategoryId in childrenMap.get(categoryId)":key="childCategoryId":activeItemId="props.selectedIds?.includes(childCategoryId) ? childCategoryId : null"- :category="categoriesStore.items[childCategoryId]"+ :category="categoriesStore.items[childCategoryId]!":categoryId="childCategoryId"@click.stop="select(childCategoryId, true)"@filter.stop="onFilter(childCategoryId)"diff --git a/app/components/categories/page/New.vue b/app/components/categories/page/New.vueindex 77350808..35203db3 100644--- a/app/components/categories/page/New.vue+++ b/app/components/categories/page/New.vue@@ -32,7 +32,7 @@ useHead({<CategoriesForm:categoryForm="categoryForm"- @update="(key: string, value: CategoryItem[keyof CategoryItem]) => categoryForm[key] = value"+ @update="(key: string, value: CategoryItem[keyof CategoryItem]) => (categoryForm as Record<string, any>)[key] = value"@afterSave="() => router.replace('/dashboard')"/></UiPage>diff --git a/app/components/categories/page/id/Edit.vue b/app/components/categories/page/id/Edit.vueindex d999c62a..6b16b610 100644--- a/app/components/categories/page/id/Edit.vue+++ b/app/components/categories/page/id/Edit.vue@@ -9,8 +9,8 @@ const router = useRouter()const route = useRoute()const categoriesStore = useCategoriesStore()-const categoryId = computed<CategoryId>(() => route.params.id)-const category = computed<CategoryItem>(() => categoriesStore.items[categoryId.value])+const categoryId = computed<CategoryId>(() => String(route.params.id))+const category = computed(() => categoriesStore.items[categoryId.value])const categoryForm = ref(categoryFormSchema.parse(category.value))useHead({@@ -30,7 +30,7 @@ useHead({<CategoriesForm:categoryId="categoryId":categoryForm="categoryForm"- @update="(key: string, value: CategoryItem[keyof CategoryItem]) => categoryForm[key] = value"+ @update="(key: string, value: CategoryItem[keyof CategoryItem]) => (categoryForm as Record<string, any>)[key] = value"@afterSave="() => router.replace(`/categories/${categoryId}`)"/></UiPage>diff --git a/app/components/categories/page/id/Index.vue b/app/components/categories/page/id/Index.vueindex 1e3b9df9..ff407935 100644--- a/app/components/categories/page/id/Index.vue+++ b/app/components/categories/page/id/Index.vue@@ -137,10 +137,8 @@ const categoriesIds = computed(() => categoriesStore.getChildrenIds(categoryId.v<template><UiPage v-if="category"><StatHeader- :config="{- isShowCategories: true,- }":filter="{+ isShowCategories: true,isShowWallets: true,}">diff --git a/app/components/categories/useCategoriesStore.test.ts b/app/components/categories/useCategoriesStore.test.tsindex 84f74495..852ea9f1 100644--- a/app/components/categories/useCategoriesStore.test.ts+++ b/app/components/categories/useCategoriesStore.test.ts@@ -94,7 +94,7 @@ describe('useCategoriesStore', () => {})expect(store.items).toHaveProperty('c1')- expect(store.items.c1.name).toBe('Food')+ expect(store.items.c1!.name).toBe('Food')})it('saves to localforage', async () => {@@ -197,9 +197,9 @@ describe('useCategoriesStore', () => {values: makeCategory({ color: '#00f', name: 'Parent' }),})- expect(store.items.child1.color).toBe('#00f')- expect(store.items.child2.color).toBe('#00f')- expect(store.items.parent1.color).toBe('#00f')+ expect(store.items.child1!.color).toBe('#00f')+ expect(store.items.child2!.color).toBe('#00f')+ expect(store.items.parent1!.color).toBe('#00f')})it('fires updateWithChildren mutation when updating children color', () => {diff --git a/app/components/categories/useCategoriesStore.ts b/app/components/categories/useCategoriesStore.tsindex 6a10dc5c..da26854c 100644--- a/app/components/categories/useCategoriesStore.ts+++ b/app/components/categories/useCategoriesStore.ts@@ -44,7 +44,7 @@ type CategoriesStore = {hasItems: ComputedRef<boolean>initCategories: () => voidisTransactible: (categoryId: CategoryId) => boolean- items: ShallowRef<Categories>+ items: import('vue').ShallowRef<Categories>recentCategoriesIds: ComputedRef<CategoryId[]>saveCategory: (params: AddCategoryParams) => Promise<RemapInfo | void> | voidsetCategories: (values: Categories | null) => void@@ -117,8 +117,8 @@ export const useCategoriesStore = defineStore('categories', (): CategoriesStore// Track most recent date per category (single pass)const latestDateByCategory = new Map<CategoryId, number>()- for (const trnId of Object.keys(trnsItems)) {- const trn = trnsItems[trnId]+ for (const trnId of Object.keys(trnsItems ?? {})) {+ const trn = trnsItems?.[trnId]if (!trn || trn.type === TrnType.Transfer || trn.categoryId === 'adjustment')continue@@ -164,7 +164,7 @@ export const useCategoriesStore = defineStore('categories', (): CategoriesStorelet data: Categories | null = categories?.length ? convexCategoriesToMap(categories) : nullif (data)- data = await mergeOfflineOps(data, 'categories')+ data = await mergeOfflineOps(data, 'categories') as CategoriessetCategories(data)}@@ -249,7 +249,7 @@ export const useCategoriesStore = defineStore('categories', (): CategoriesStore// Optimistic UIapplyOptimisticUpdate(id, values, isUpdateChildCategoriesColor, categoryChildIds)- if (!pushSaveOp({ entity: 'categories', id, isDemo: isDemo.value, isExisting: !!isExisting, values: values as unknown as Record<string, unknown> }))+ if (!pushSaveOp({ entity: 'categories', id, isDemo: !!isDemo.value, isExisting: !!isExisting, values: values as unknown as Record<string, unknown> }))returnconst { api, client } = useConvexClientWithApi()@@ -259,7 +259,7 @@ export const useCategoriesStore = defineStore('categories', (): CategoriesStorecolor: values.color,icon: values.icon,name: values.name,- parentId: values.parentId && values.parentId !== 0 ? asConvexId<'categories'>(String(values.parentId)) : 0 as const,+ parentId: values.parentId ? asConvexId<'categories'>(String(values.parentId)) : 0 as const,showInLastUsed: values.showInLastUsed,showInQuickSelector: values.showInQuickSelector,}@@ -298,7 +298,7 @@ export const useCategoriesStore = defineStore('categories', (): CategoriesStoreif (trnsIds?.length)trnsStore.removeTrnsFromStore(trnsIds)- if (!pushDeleteOp({ entity: 'categories', id, isDemo: isDemo.value }))+ if (!pushDeleteOp({ entity: 'categories', id, isDemo: !!isDemo.value }))return// Fire-and-forget mutation, cleanup on success@@ -315,7 +315,7 @@ export const useCategoriesStore = defineStore('categories', (): CategoriesStore}return {- cancelPersist: () => debouncedPersist.cancel?.(),+ cancelPersist: () => (debouncedPersist as unknown as { cancel?: () => void }).cancel?.(),categoriesForBeParent,categoriesIdsForTrnValues,categoriesRootIds,diff --git a/app/components/categories/utils.test.ts b/app/components/categories/utils.test.tsindex 9ac48f69..71750ed0 100644--- a/app/components/categories/utils.test.ts+++ b/app/components/categories/utils.test.ts@@ -10,42 +10,56 @@ export const mockCategories: Categories = {icon: 'home',name: 'Selectable Child',parentId: 'withChilds',+ showInLastUsed: true,+ showInQuickSelector: false,},child2: {color: 'red',icon: 'home',name: 'Selectable Child',parentId: 'withChilds',+ showInLastUsed: true,+ showInQuickSelector: false,},root: {color: 'red',icon: 'home',name: 'Selectable Root',parentId: 0,+ showInLastUsed: true,+ showInQuickSelector: false,},transfer: {color: 'var(--ui-primary)',icon: 'mdi:repeat',name: 'Transfer',parentId: 0,+ showInLastUsed: false,+ showInQuickSelector: false,},transfer2: {color: 'var(--ui-primary)',icon: 'mdi:repeat',name: 'перевод',parentId: 0,+ showInLastUsed: true,+ showInQuickSelector: false,},transfer3: {color: 'var(--ui-primary)',icon: 'mdi:repeat',name: 'transfer',parentId: 0,+ showInLastUsed: true,+ showInQuickSelector: false,},withChilds: {color: 'red',icon: 'home',name: 'No Selectable with childs',parentId: 0,+ showInLastUsed: true,+ showInQuickSelector: false,},}diff --git a/app/components/categories/utils.ts b/app/components/categories/utils.tsindex e643a1de..b621dbe7 100644--- a/app/components/categories/utils.ts+++ b/app/components/categories/utils.ts@@ -4,7 +4,7 @@ export function getTransactibleCategoriesIds(items: Categories, ids?: CategoryIdconst childrenMap = new Map<CategoryId, CategoryId[]>()for (const id of Object.keys(items ?? {})) {const parentId = items[id]?.parentId- if (parentId && parentId !== 0) {+ if (parentId) {const pid = String(parentId)if (!childrenMap.has(pid))childrenMap.set(pid, [])diff --git a/app/components/color/Palette.vue b/app/components/color/Palette.vueindex 38bd1343..a2a04ec7 100644--- a/app/components/color/Palette.vue+++ b/app/components/color/Palette.vue@@ -59,7 +59,7 @@ const walletColorsUsed = computed(() => {<div class="flex-center h-10" :style="{ background: color }"><Iconv-if="props.isCategory && (categoryIconByColor.has(color) || color === props.activeColor)"- :name="props.activeColor === color ? props.icon : categoryIconByColor.get(color)"+ :name="props.activeColor === color ? props.icon ?? '' : categoryIconByColor.get(color) ?? ''"size="20"class="text-icon-primary"/>@@ -79,7 +79,7 @@ const walletColorsUsed = computed(() => {{{ t('color.custom') }}</template><FormInput- :modelValue="activeColor"+ :modelValue="activeColor ?? ''"type="color"@update:modelValue="(value: string) => emit('click', value)"/>diff --git a/app/components/date/Trns.vue b/app/components/date/Trns.vueindex 9dc1065f..53c3d3ac 100644--- a/app/components/date/Trns.vue+++ b/app/components/date/Trns.vue@@ -6,11 +6,14 @@ const props = defineProps<{}>()const { formatDate } = useDateFormats()-const formattedDate = computed(() => formatDate(props.date, 'full'))+const formattedDate = computed(() => {+ const result = formatDate(props.date, 'full')+ return typeof result === 'object' ? result : undefined+})</script><template>- <div class="flex items-center gap-2">+ <div v-if="formattedDate" class="flex items-center gap-2"><div class="_w-10 _text-center font-secondary text-3xl font-semibold">{{ formattedDate.day }}</div>diff --git a/app/components/date/useDateFormats.ts b/app/components/date/useDateFormats.tsindex 4123f3ad..f71a3108 100644--- a/app/components/date/useDateFormats.ts+++ b/app/components/date/useDateFormats.ts@@ -35,6 +35,7 @@ export function useDateFormats() {month: formatByLocale(date, 'MMM', locale.value),week: formatByLocale(date, 'dd.MM', locale.value),weekday: `${diff < 2 ? `${formatDateToStringWithLast({ by: 'day', duration: 1, end: date, start: date, type: 'start' })}, ` : ''} ${formatByLocale(date, 'EEEE', locale.value)}`,+ year: formatByLocale(date, 'yyyy', locale.value),}case 'trnItem':diff --git a/app/components/demo/data.ts b/app/components/demo/data.tsindex 5d870555..1710b9b8 100644--- a/app/components/demo/data.ts+++ b/app/components/demo/data.ts@@ -1,17 +1,39 @@-import type { CategoryId, CategoryItem } from '~/components/categories/types'-import type { WalletId, WalletItem } from '~/components/wallets/types'+import type { CategoryId } from '~/components/categories/types'+import type { WalletId } from '~/components/wallets/types'type LocaleString = {en: stringru: string}+type DemoCategoryItem = {+ color: string+ icon: string+ name: LocaleString+ order?: number+ parentId: string | 0+ showInLastUsed: boolean+ showInQuickSelector: boolean+ updatedAt?: number+}++type DemoWalletItem = {+ color: string+ creditLimit?: number+ currency: string+ desc: LocaleString+ isArchived?: boolean+ isExcludeInTotal?: boolean+ isWithdrawal?: boolean+ name: LocaleString+ order?: number+ type: 'cash' | 'cashless' | 'credit' | 'crypto' | 'debt' | 'deposit'+ updatedAt?: number+}+export const data: {- categories: Record<CategoryId, Omit<CategoryItem, 'name'> & { name: LocaleString }>- wallets: Record<WalletId, Omit<WalletItem, 'name' | 'desc'> & {- desc: LocaleString- name: LocaleString- }>+ categories: Record<CategoryId, DemoCategoryItem>+ wallets: Record<WalletId, DemoWalletItem>} = {categories: {'4b6473ee7324': {diff --git a/app/components/demo/useDemo.ts b/app/components/demo/useDemo.tsindex 0da16990..fc3e45d3 100644--- a/app/components/demo/useDemo.ts+++ b/app/components/demo/useDemo.ts@@ -39,7 +39,7 @@ export function useDemo() {return acc}, {} as Categories),wallets: Object.entries(data.wallets).reduce((acc, [id, wallet]) => {- acc[id] = { ...wallet, desc: wallet.desc[locale], name: wallet.name[locale] }+ acc[id] = { ...wallet, desc: wallet.desc[locale], name: wallet.name[locale] } as Wallets[string]return acc}, {} as Wallets),}@@ -55,17 +55,17 @@ export function useDemo() {const transactibleIds = categoriesStore.getTransactibleIds()const walletIds = walletsStore.sortedIds- const trns: Trns = Array.from({ length: config.trnsCount }).reduce((acc, _, i) => {+ const trns: Trns = Array.from({ length: config.trnsCount }).reduce<Trns>((acc, _, i) => {acc[i] = {amount: Math.floor(Math.random() * config.amount) + 1,- categoryId: transactibleIds[Math.floor(Math.random() * transactibleIds.length)],+ categoryId: transactibleIds[Math.floor(Math.random() * transactibleIds.length)]!,date: startDate + Math.random() * (endDate - startDate),- id: i,type: Math.random() < 0.5 ? 0 : 1,- walletId: walletIds[Math.floor(Math.random() * walletIds.length)],+ updatedAt: Date.now(),+ walletId: walletIds[Math.floor(Math.random() * walletIds.length)]!,}return acc- }, {} as Trns)+ }, {})trnsStore.setTrns(trns)}diff --git a/app/components/form/Input.vue b/app/components/form/Input.vueindex 750a3bca..d2489861 100644--- a/app/components/form/Input.vue+++ b/app/components/form/Input.vue@@ -16,6 +16,6 @@ const emit = defineEmits<{:value="props.modelValue":type="props.type ?? 'text'"class="border-item-6 bg-item-3 placeholder:text-muted m-0 w-full rounded-sm border border-solid px-3 py-2 text-base font-normal outline-none hover:bg-(--item-5) focus:border-(--ui-primary)"- @input="(event: HTMLInputEvent) => emit('update:modelValue', event.target.value)"+ @input="(event: Event) => emit('update:modelValue', (event.target as HTMLInputElement).value)"></template>diff --git a/app/components/form/Select.vue b/app/components/form/Select.vueindex afbdaefb..30b4e90e 100644--- a/app/components/form/Select.vue+++ b/app/components/form/Select.vue@@ -15,7 +15,7 @@ const emit = defineEmits<{<template><select:value="props.value"- @change="emit('change', $event.target.value)"+ @change="emit('change', ($event.target as HTMLSelectElement).value)"><optionv-for="option in props.options"diff --git a/app/components/form/Textarea.vue b/app/components/form/Textarea.vueindex 9aa88ac9..a199651c 100644--- a/app/components/form/Textarea.vue+++ b/app/components/form/Textarea.vue@@ -15,6 +15,6 @@ const emit = defineEmits<{:placeholder="props.placeholder":value="props.modelValue"class="border-item-6 bg-item-3 placeholder:text-muted m-0 w-full rounded-sm border border-solid px-3 py-2 text-base font-normal outline-none hover:bg-(--item-5) focus:border-(--ui-primary)"- @input="(event: HTMLInputEvent) => emit('update:modelValue', event.target.value)"+ @input="(event: Event) => emit('update:modelValue', (event.target as HTMLTextAreaElement).value)"/></template>diff --git a/app/components/layout/useMenuData.ts b/app/components/layout/useMenuData.tsindex 7c3babe6..3b759774 100644--- a/app/components/layout/useMenuData.ts+++ b/app/components/layout/useMenuData.ts@@ -24,7 +24,7 @@ export function useMenuData() {const route = useRoute()const items = computed<Record<string, MenuItem>>(() => {- const list = {+ const list: Record<string, MenuItem> = {trnForm: {icon: 'hugeicons:plus-sign-square',name: t('trnForm.createTrn'),diff --git a/app/components/locale/Switcher.vue b/app/components/locale/Switcher.vueindex 19a21e32..55042345 100644--- a/app/components/locale/Switcher.vue+++ b/app/components/locale/Switcher.vue@@ -31,7 +31,7 @@ const options = [{<FormSelect:options:value="locale"- @change="(locale: LocaleSlug) => userStore.saveUserLocale(locale)"+ @change="(value: string) => userStore.saveUserLocale(value as LocaleSlug)"/></template>diff --git a/app/components/offline/helpers.test.ts b/app/components/offline/helpers.test.tsindex 8e051495..3c459074 100644--- a/app/components/offline/helpers.test.ts+++ b/app/components/offline/helpers.test.ts@@ -41,7 +41,7 @@ describe('pushOfflineOp', () => {const queue = await getAllOfflineOps()expect(queue).toHaveLength(1)expect(queue[0]).toMatchObject({ data: { amount: 100 }, entity: 'trns', id: 'trn1', type: 'create' })- expect(queue[0].timestamp).toBeGreaterThan(0)+ expect(queue[0]!.timestamp).toBeGreaterThan(0)})it('appends operations for different entities', async () => {@@ -59,8 +59,8 @@ describe('pushOfflineOp', () => {const queue = await getAllOfflineOps()expect(queue).toHaveLength(1)- expect(queue[0].type).toBe('create')- expect(queue[0].data).toEqual({ name: 'Cash Updated' })+ expect(queue[0]!.type).toBe('create')+ expect(queue[0]!.data).toEqual({ name: 'Cash Updated' })})it('create + delete → both removed', async () => {@@ -77,8 +77,8 @@ describe('pushOfflineOp', () => {const queue = await getAllOfflineOps()expect(queue).toHaveLength(1)- expect(queue[0].type).toBe('update')- expect(queue[0].data).toEqual({ name: 'New' })+ expect(queue[0]!.type).toBe('update')+ expect(queue[0]!.data).toEqual({ name: 'New' })})it('update + delete → replace with delete', async () => {@@ -87,7 +87,7 @@ describe('pushOfflineOp', () => {const queue = await getAllOfflineOps()expect(queue).toHaveLength(1)- expect(queue[0].type).toBe('delete')+ expect(queue[0]!.type).toBe('delete')})it('delete + any → ignores new operation', async () => {@@ -96,7 +96,7 @@ describe('pushOfflineOp', () => {const queue = await getAllOfflineOps()expect(queue).toHaveLength(1)- expect(queue[0].type).toBe('delete')+ expect(queue[0]!.type).toBe('delete')})})})@@ -110,7 +110,7 @@ describe('removeOfflineOp', () => {const queue = await getAllOfflineOps()expect(queue).toHaveLength(1)- expect(queue[0].entity).toBe('trns')+ expect(queue[0]!.entity).toBe('trns')})it('does nothing when not found', async () => {@@ -142,7 +142,7 @@ describe('getOfflineOpsByEntity', () => {const walletOps = await getOfflineOpsByEntity('wallets')expect(walletOps).toHaveLength(1)- expect(walletOps[0].entity).toBe('wallets')+ expect(walletOps[0]!.entity).toBe('wallets')})it('returns empty array when no matching ops', async () => {@@ -174,9 +174,9 @@ describe('cross-entity isolation', () => {const walletsOps = await getOfflineOpsByEntity('wallets')expect(trnsOps).toHaveLength(1)- expect(trnsOps[0].data).toEqual({ a: 1 })+ expect(trnsOps[0]!.data).toEqual({ a: 1 })expect(walletsOps).toHaveLength(1)- expect(walletsOps[0].data).toEqual({ b: 2 })+ expect(walletsOps[0]!.data).toEqual({ b: 2 })})it('collapsing only applies within same entity+id', async () => {@@ -187,6 +187,6 @@ describe('cross-entity isolation', () => {const queue = await getAllOfflineOps()// trns create+delete collapsed to nothing, wallets create remainsexpect(queue).toHaveLength(1)- expect(queue[0].entity).toBe('wallets')+ expect(queue[0]!.entity).toBe('wallets')})})diff --git a/app/components/offline/helpers.ts b/app/components/offline/helpers.tsindex cee84c62..84746a79 100644--- a/app/components/offline/helpers.ts+++ b/app/components/offline/helpers.ts@@ -87,7 +87,7 @@ async function pushOfflineOpImpl(op: Omit<OfflineOp, 'timestamp'>): Promise<voidreturn}- const existing = queue[existingIdx]+ const existing = queue[existingIdx]!// delete is terminal — ignore any new operationif (existing.type === 'delete') {@@ -103,7 +103,7 @@ async function pushOfflineOpImpl(op: Omit<OfflineOp, 'timestamp'>): Promise<void}else {// update → delete: replace- queue[existingIdx] = { ...op, timestamp: Date.now() }+ queue[existingIdx] = { ...op, timestamp: Date.now() } as OfflineOplogger.log(`collapsed update→delete: ${op.entity}/${op.id}`)}await writeQueue(queue)@@ -223,7 +223,7 @@ async function clearOfflineQueueImpl(): Promise<void> {function findLastIndex<T>(arr: T[], predicate: (item: T) => boolean): number {for (let i = arr.length - 1; i >= 0; i--) {- if (predicate(arr[i]))+ if (predicate(arr[i] as T))return i}return -1diff --git a/app/components/offline/replay.ts b/app/components/offline/replay.tsindex 7ca873c9..49a51f8e 100644--- a/app/components/offline/replay.ts+++ b/app/components/offline/replay.ts@@ -1,6 +1,7 @@import type { CategoryItem } from '~/components/categories/types'import type { CurrencyCode } from '~/components/currencies/types'import type { LocaleSlug } from '~/components/locale/types'+import type { TrnItem } from '~/components/trns/types'import type { WalletItem } from '~/components/wallets/types'import { useCategoriesStore } from '~/components/categories/useCategoriesStore'@@ -19,7 +20,7 @@ export function isReplaying(): boolean {return _isReplaying}-async function collectRemaps(promises: (Promise<unknown> | undefined)[], remapIds: Map<string, string>) {+async function collectRemaps(promises: (Promise<unknown> | void | undefined)[], remapIds: Map<string, string>) {const results = await Promise.all(promises.map(p => p ?? Promise.resolve()))for (const { convexId, localId } of extractRemaps(results)) {remapIds.set(localId, convexId)diff --git a/app/components/offline/replayHelpers.test.ts b/app/components/offline/replayHelpers.test.tsindex 7da7cd12..7af8ebd6 100644--- a/app/components/offline/replayHelpers.test.ts+++ b/app/components/offline/replayHelpers.test.ts@@ -1,7 +1,7 @@import { describe, expect, it } from 'vitest'import type { OfflineOp } from '~/components/offline/types'-import type { TrnItem } from '~/components/trns/types'+import type { Transaction, Transfer, TrnItem } from '~/components/trns/types'import { TrnType } from '~/components/trns/types'@@ -26,7 +26,7 @@ describe('remapTrnIds', () => {walletId: 'local_w1',} as TrnItem- const result = remapTrnIds(trn, remap)+ const result = remapTrnIds(trn, remap) as Transactionexpect(result.walletId).toBe('convex_w1')expect(result.categoryId).toBe('convex_c1')})@@ -44,7 +44,7 @@ describe('remapTrnIds', () => {updatedAt: 1000,} as TrnItem- const result = remapTrnIds(trn, remap2)+ const result = remapTrnIds(trn, remap2) as Transferexpect(result.expenseWalletId).toBe('convex_w1')expect(result.incomeWalletId).toBe('convex_w2')})@@ -59,7 +59,7 @@ describe('remapTrnIds', () => {walletId: 'real_w1',} as TrnItem- const result = remapTrnIds(trn, remap)+ const result = remapTrnIds(trn, remap) as Transactionexpect(result.walletId).toBe('real_w1')expect(result.categoryId).toBe('food')})@@ -72,7 +72,7 @@ describe('remapTrnIds', () => {type: TrnType.Expense,updatedAt: 1000,walletId: 'local_w1',- } as TrnItem+ } as TransactionremapTrnIds(trn, remap)expect(trn.walletId).toBe('local_w1')@@ -167,7 +167,7 @@ describe('splitCategoryOps', () => {const result = splitCategoryOps(ops)expect(result.parentOps).toHaveLength(2)expect(result.childOps).toHaveLength(1)- expect(result.childOps[0].id).toBe('c2')+ expect(result.childOps[0]!.id).toBe('c2')})it('puts delete ops in parentOps', () => {@@ -178,7 +178,7 @@ describe('splitCategoryOps', () => {const result = splitCategoryOps(ops)expect(result.parentOps).toHaveLength(1)- expect(result.parentOps[0].type).toBe('delete')+ expect(result.parentOps[0]!.type).toBe('delete')expect(result.childOps).toHaveLength(1)})diff --git a/app/components/offline/replayHelpers.ts b/app/components/offline/replayHelpers.tsindex b89cdbbb..21eb0553 100644--- a/app/components/offline/replayHelpers.ts+++ b/app/components/offline/replayHelpers.ts@@ -88,7 +88,7 @@ export function splitCategoryOps(ops: OfflineOp[]): {continue}const data = op.data as unknown as CategoryItem- if (!data.parentId || data.parentId === 0) {+ if (!data.parentId || data.parentId === (0 as string | 0)) {parentOps.push(op)}else {diff --git a/app/components/stat/categories/Line.vue b/app/components/stat/categories/Line.vueindex 38127f8d..217959f8 100644--- a/app/components/stat/categories/Line.vue+++ b/app/components/stat/categories/Line.vue@@ -31,7 +31,10 @@ const categoriesStore = useCategoriesStore()const currenciesStore = useCurrenciesStore()const category = computed(() => categoriesStore.items[props.item.id])-const parentCategory = computed(() => categoriesStore.items[category.value?.parentId])+const parentCategory = computed(() => {+ const pid = category.value?.parentId+ return pid ? categoriesStore.items[pid] : undefined+})function getBarStyle() {if (!props.item.value || props.item.value === 0)diff --git a/app/components/stat/categories/Section2.vue b/app/components/stat/categories/Section2.vueindex cf583bbf..8e652471 100644--- a/app/components/stat/categories/Section2.vue+++ b/app/components/stat/categories/Section2.vue@@ -2,7 +2,7 @@import { useStorage } from '@vueuse/core'import type { Categories, CategoryId } from '~/components/categories/types'-import type { CategoryWithData, StatTabSlug } from '~/components/stat/types'+import type { CategoryWithData, SeriesSlugSelected, StatTabSlug } from '~/components/stat/types'import type { TrnId } from '~/components/trns/types'import { useCategoriesStore } from '~/components/categories/useCategoriesStore'@@ -14,7 +14,7 @@ const props = defineProps<{preCategoriesIds?: CategoryId[]selectedTrnsIds?: TrnId[]storageKey: string- type: StatTabSlug+ type: SeriesSlugSelected | StatTabSlug}>()const emit = defineEmits<{diff --git a/app/components/stat/categories/collectAndGroup.test.ts b/app/components/stat/categories/collectAndGroup.test.tsindex 7a2f6eaa..b9f262fc 100644--- a/app/components/stat/categories/collectAndGroup.test.ts+++ b/app/components/stat/categories/collectAndGroup.test.ts@@ -5,13 +5,13 @@ import type { CategoriesWithData } from '~/components/stat/types'import { collectCategoriesByTrns, flattenCategoriesWithValues, groupCategoriesWithValues, sortCategoriesByAmount } from '~/components/stat/categories/collectAndGroup'-const categories: Categories = {- food: { color: 'red', name: 'Food', order: 0, parentId: 0 },- groceries: { color: 'green', name: 'Groceries', order: 0, parentId: 'food' },- restaurants: { color: 'blue', name: 'Restaurants', order: 0, parentId: 'food' },- salary: { color: 'yellow', name: 'Salary', order: 0, parentId: 0 },- transport: { color: 'orange', name: 'Transport', order: 0, parentId: 0 },-}+const categories = {+ food: { color: 'red', name: 'Food', parentId: 0 },+ groceries: { color: 'green', name: 'Groceries', parentId: 'food' },+ restaurants: { color: 'blue', name: 'Restaurants', parentId: 'food' },+ salary: { color: 'yellow', name: 'Salary', parentId: 0 },+ transport: { color: 'orange', name: 'Transport', parentId: 0 },+} as unknown as Categoriesconst trnsItems = {t1: { categoryId: 'groceries' },@@ -31,10 +31,10 @@ describe('collectCategoriesByTrns', () => {trnsItems,})- expect(result.groceries.trnsIds).toEqual(['t1', 't2'])- expect(result.restaurants.trnsIds).toEqual(['t3'])- expect(result.salary.trnsIds).toEqual(['t4'])- expect(result.transport.trnsIds).toEqual(['t5'])+ expect(result.groceries!.trnsIds).toEqual(['t1', 't2'])+ expect(result.restaurants!.trnsIds).toEqual(['t3'])+ expect(result.salary!.trnsIds).toEqual(['t4'])+ expect(result.transport!.trnsIds).toEqual(['t5'])})it('skips transfer category', () => {@@ -76,9 +76,9 @@ describe('collectCategoriesByTrns', () => {})expect(result.transport).toBeDefined()- expect(result.transport.trnsIds).toEqual([])- expect(result.salary.trnsIds).toEqual([])- expect(result.groceries.trnsIds).toEqual(['t1'])+ expect(result.transport!.trnsIds).toEqual([])+ expect(result.salary!.trnsIds).toEqual([])+ expect(result.groceries!.trnsIds).toEqual(['t1'])})it('preCategoriesIds does not overwrite existing data', () => {@@ -89,7 +89,7 @@ describe('collectCategoriesByTrns', () => {trnsItems,})- expect(result.groceries.trnsIds).toEqual(['t1', 't2'])+ expect(result.groceries!.trnsIds).toEqual(['t1', 't2'])})it('returns empty for empty trnsIds', () => {@@ -130,12 +130,12 @@ describe('flattenCategoriesWithValues', () => {const result2 = flattenCategoriesWithValues(data2, (ids) => {const map: Record<string, number> = { h: 500, l: 200, n: -100 }- return map[ids[0]] ?? 0+ return map[ids[0]!] ?? 0})- expect(result2[0].value).toBe(500)- expect(result2[1].value).toBe(200)- expect(result2[2].value).toBe(-100)+ expect(result2[0]!.value).toBe(500)+ expect(result2[1]!.value).toBe(200)+ expect(result2[2]!.value).toBe(-100)})it('puts zero-value categories at the end', () => {@@ -146,8 +146,8 @@ describe('flattenCategoriesWithValues', () => {const result = flattenCategoriesWithValues(data, ids => ids.length > 0 ? 100 : 0)- expect(result[0].id).toBe('full')- expect(result[1].id).toBe('empty')+ expect(result[0]!.id).toBe('full')+ expect(result[1]!.id).toBe('empty')})})@@ -163,11 +163,11 @@ describe('groupCategoriesWithValues', () => {const result = groupCategoriesWithValues(collected, categories, computeValue)expect(result).toHaveLength(1)- expect(result[0].id).toBe('food')- expect(result[0].name).toBe('Food')- expect(result[0].value).toBe(-150) // -100 + -50- expect(result[0].trnsIds).toEqual(['t1', 't2', 't3'])- expect(result[0].categories).toHaveLength(2)+ expect(result[0]!.id).toBe('food')+ expect(result[0]!.name).toBe('Food')+ expect(result[0]!.value).toBe(-150) // -100 + -50+ expect(result[0]!.trnsIds).toEqual(['t1', 't2', 't3'])+ expect(result[0]!.categories).toHaveLength(2)})it('keeps root categories without parent as standalone', () => {@@ -215,11 +215,11 @@ describe('groupCategoriesWithValues', () => {const computeValue = (ids: string[]) => ids.length * -50const result = groupCategoriesWithValues(collected, categories, computeValue)- const foodGroup = result[0]+ const foodGroup = result[0]!// restaurants: -100, groceries: -50 → restaurants first (larger absolute negative)- expect(foodGroup.categories![0].id).toBe('restaurants')- expect(foodGroup.categories![1].id).toBe('groceries')+ expect(foodGroup.categories![0]!.id).toBe('restaurants')+ expect(foodGroup.categories![1]!.id).toBe('groceries')})it('sorts parent groups by total amount', () => {@@ -233,8 +233,8 @@ describe('groupCategoriesWithValues', () => {const result = groupCategoriesWithValues(collected, categories, computeValue)// transport: -300, food(groceries): -100 → transport first- expect(result[0].id).toBe('transport')- expect(result[1].id).toBe('food')+ expect(result[0]!.id).toBe('transport')+ expect(result[1]!.id).toBe('food')})it('handles empty input', () => {diff --git a/app/components/stat/chart/View.vue b/app/components/stat/chart/View.vueindex fa762290..720ced4b 100644--- a/app/components/stat/chart/View.vue+++ b/app/components/stat/chart/View.vue@@ -14,6 +14,13 @@ import { formatByLocale } from '~/components/date/utils'import { config, lineConfig } from '~/components/stat/chart/config'import { getLocalAmount } from '~/components/stat/chart/utils'+type TooltipParam = {+ color: string+ name: string+ seriesName: string+ value: number+}+const {chartType = 'line',period,@@ -64,11 +71,12 @@ const option = computed(() => {},})- data.xAxis.axisLabel.formatter = (date: string) => {+ const xAxis = data.xAxis as Record<string, any>+ xAxis.axisLabel.formatter = (date: string) => {return formatByLocale(new Date(+date), getFormatForChart(period), locale.value)}- data.xAxis.axisPointer.label.formatter = ({ value }: { value: string }) => {+ xAxis.axisPointer.label.formatter = ({ value }: { value: string }) => {return formatByLocale(new Date(+value), getFormatForChart(period), locale.value)}@@ -108,12 +116,12 @@ function setChartSeries(series: ChartSeries[]) {<template #tooltip="params"><div class="rounded-md bg-(--item-5) px-2 pt-2"><div class="text-muted pb-2 text-xs">- {{ formatByLocale(new Date(+params[0].name), getFormatForChart(period), locale) }}+ {{ formatByLocale(new Date(+(params as TooltipParam[])[0]!.name), getFormatForChart(period), locale) }}</div><div class="grid gap-0"><div- v-for="(param, i) in params" :key="i"+ v-for="(param, i) in (params as TooltipParam[])" :key="i"class="border-item-6 flex items-center justify-between gap-4 border-b pb-1 last:border-b-0"><div class="flex items-center gap-2">diff --git a/app/components/stat/chart/useStatChart.ts b/app/components/stat/chart/useStatChart.tsindex 12e852e1..13ac0051 100644--- a/app/components/stat/chart/useStatChart.ts+++ b/app/components/stat/chart/useStatChart.ts@@ -1,7 +1,7 @@import type { TotalReturns } from '~/components/amount/getTotal'import type { DateUTC } from '~/components/date/types'import type { ChartType } from '~/components/stat/chart/types'-import type { ChartSeries, StatTabSlug } from '~/components/stat/types'+import type { ChartSeries, SeriesSlug } from '~/components/stat/types'import { seriesOptions } from '~/components/stat/chart/config'import { markArea } from '~/components/stat/chart/utils'@@ -19,7 +19,7 @@ export function useStatChart() {value: 'line',}])- function createSeriesItem(typeItem: StatTabSlug, data: TotalReturns[], average?: number | false): ChartSeries {+ function createSeriesItem(typeItem: SeriesSlug, data: TotalReturns[], average?: number | false): ChartSeries {let markLine = {}if (average) {markLine = {@@ -41,11 +41,11 @@ export function useStatChart() {}return {- color: seriesOptions[typeItem]?.color,+ color: seriesOptions[typeItem]?.color as string | undefined,data: data.map(i => Math.abs(i[typeItem])),markLine,name: t(`money.${typeItem}`),- type: seriesOptions[typeItem]?.type,+ type: seriesOptions[typeItem]?.type ?? 'bar',}}diff --git a/app/components/stat/chart/utils.ts b/app/components/stat/chart/utils.tsindex 82a9f1d7..a45902b2 100644--- a/app/components/stat/chart/utils.ts+++ b/app/components/stat/chart/utils.ts@@ -1,4 +1,7 @@-export function markArea(value: number) {+export function markArea(value: number): {+ data: [{ xAxis: string }, { xAxis: string }][]+ itemStyle: { color: string, opacity: number }+} {return {data: [[{ xAxis: `${value}` }, { xAxis: `${value}` }]],itemStyle: { color: 'var(--chart-line)', opacity: 1 },diff --git a/app/components/stat/date/Quick.vue b/app/components/stat/date/Quick.vueindex 01b9528b..76b118bc 100644--- a/app/components/stat/date/Quick.vue+++ b/app/components/stat/date/Quick.vue@@ -12,7 +12,7 @@ const sliderObj = ref<Swiper | null>(null)onMounted(() => {const initialSlide = 1- sliderObj.value = new Swiper(sliderRef.value, {+ sliderObj.value = new Swiper(sliderRef.value!, {autoHeight: true,initialSlide,longSwipesMs: 60,diff --git a/app/components/stat/date/Selector.vue b/app/components/stat/date/Selector.vueindex 03f30d03..160fbfad 100644--- a/app/components/stat/date/Selector.vue+++ b/app/components/stat/date/Selector.vue@@ -39,7 +39,7 @@ const dateRange = ref({start: parseUCalendarDate(statDate.range.value.start),})-function onSelectRange(value: unknown) {+function onSelectRange(value: any) {const range = {end: value.end,start: value.start,@@ -129,7 +129,7 @@ function onSelectRange(value: unknown) {<UCalendarv-if="tabs.selected.value === 'calendar'"- v-model="dateRange"+ v-model="(dateRange as any)":maxValue="getUCalendarToday()":numberOfMonths="2"rangediff --git a/app/components/stat/filter/Selected.vue b/app/components/stat/filter/Selected.vueindex 16359f28..37ebaff6 100644--- a/app/components/stat/filter/Selected.vue+++ b/app/components/stat/filter/Selected.vue@@ -23,7 +23,7 @@ const itemClasses = 'bg-item-3 rounded-sm':key="walletId":class="itemClasses":walletId="walletId"- :wallet="walletsStore.itemsComputed[walletId]"+ :wallet="walletsStore.itemsComputed[walletId]!"insideClasses="!min-h-[38px]"altisShowCreditLimit@@ -36,7 +36,7 @@ const itemClasses = 'bg-item-3 rounded-sm'<CategoriesItemv-for="categoryId in filter?.categoriesIds?.value":key="categoryId"- :category="categoriesStore.items[categoryId]"+ :category="categoriesStore.items[categoryId]!":categoryId="categoryId":class="itemClasses"altdiff --git a/app/components/stat/intervals.test.ts b/app/components/stat/intervals.test.tsindex 7b1fac95..1503e274 100644--- a/app/components/stat/intervals.test.ts+++ b/app/components/stat/intervals.test.ts@@ -64,9 +64,9 @@ describe('bucketTrnsByIntervals', () => {)expect(result).toHaveLength(3)- expect(result[0].trnsIds).toEqual(['t1', 't3'])- expect(result[1].trnsIds).toEqual(['t2'])- expect(result[2].trnsIds).toEqual([])+ expect(result[0]!.trnsIds).toEqual(['t1', 't3'])+ expect(result[1]!.trnsIds).toEqual(['t2'])+ expect(result[2]!.trnsIds).toEqual([])})it('computes totals via callback', () => {@@ -82,9 +82,9 @@ describe('bucketTrnsByIntervals', () => {ids => makeTotal(ids.length * 500, 0),)- expect(result[0].total.income).toBe(1000)- expect(result[0].total.sum).toBe(1000)- expect(result[1].total.income).toBe(0)+ expect(result[0]!.total.income).toBe(1000)+ expect(result[0]!.total.sum).toBe(1000)+ expect(result[1]!.total.income).toBe(0)})it('returns empty array for empty intervals', () => {@@ -98,7 +98,7 @@ describe('bucketTrnsByIntervals', () => {}const result = bucketTrnsByIntervals(trnsItems, ['t1'], intervals, () => zeroTotal)- expect(result[0].trnsIds).toEqual([])+ expect(result[0]!.trnsIds).toEqual([])})it('skips transactions outside any interval', () => {@@ -111,20 +111,20 @@ describe('bucketTrnsByIntervals', () => {}const result = bucketTrnsByIntervals(trnsItems, ['t1', 't2', 't3'], intervals, ids => makeTotal(0, ids.length))- expect(result[0].trnsIds).toEqual([])- expect(result[1].trnsIds).toEqual(['t3'])- expect(result[2].trnsIds).toEqual([])+ expect(result[0]!.trnsIds).toEqual([])+ expect(result[1]!.trnsIds).toEqual(['t3'])+ expect(result[2]!.trnsIds).toEqual([])})it('skips missing transaction IDs', () => {const result = bucketTrnsByIntervals({}, ['missing'], intervals, () => zeroTotal)- expect(result[0].trnsIds).toEqual([])+ expect(result[0]!.trnsIds).toEqual([])})it('preserves range references in output', () => {const result = bucketTrnsByIntervals({}, [], intervals, () => zeroTotal)- expect(result[0].range).toBe(intervals[0])- expect(result[2].range).toBe(intervals[2])+ expect(result[0]!.range).toBe(intervals[0])+ expect(result[2]!.range).toBe(intervals[2])})})diff --git a/app/components/stat/intervals.ts b/app/components/stat/intervals.tsindex 26017458..24cdec37 100644--- a/app/components/stat/intervals.ts+++ b/app/components/stat/intervals.ts@@ -29,14 +29,14 @@ export function bucketTrnsByIntervals(let hi = intervalsInRange.length - 1while (lo <= hi) {const mid = (lo + hi) >> 1- if (trnDate < intervalsInRange[mid].start) {+ if (trnDate < intervalsInRange[mid]!.start) {hi = mid - 1}- else if (trnDate > intervalsInRange[mid].end) {+ else if (trnDate > intervalsInRange[mid]!.end) {lo = mid + 1}else {- buckets[mid].push(id)+ buckets[mid]!.push(id)break}}@@ -44,8 +44,8 @@ export function bucketTrnsByIntervals(return intervalsInRange.map((range, i) => ({range,- total: computeTotal(buckets[i]),- trnsIds: buckets[i],+ total: computeTotal(buckets[i]!),+ trnsIds: buckets[i]!,}))}diff --git a/app/components/stat/sum/Wrap.vue b/app/components/stat/sum/Wrap.vueindex bd1f586e..5945db61 100644--- a/app/components/stat/sum/Wrap.vue+++ b/app/components/stat/sum/Wrap.vue@@ -10,13 +10,13 @@ import { filterKey, statConfigKey, statDateKey } from '~/components/stat/injecticonst props = defineProps<{averageTotal?: Record<string, number>categoryId?: CategoryId- filteredType: StatTabSlug+ filteredType: SeriesSlugSelectedisShowAverage: booleanisShowExpense: booleanisShowIncome: booleantotal: TotalReturnstrnsIds: TrnId[]- type: StatTabSlug+ type: SeriesSlugSelected | StatTabSlugwalletId?: WalletId}>()@@ -111,9 +111,9 @@ function onClick(type: SeriesSlugSelected) {<div v-else class="flex items-center"><StatSumItem- :amount="props.type === 'income' ? total[props.type] : -total[props.type]"+ :amount="props.type === 'income' ? total.income : -((total as Record<string, number>)[props.type]!)":class="className"- :type="props.type"+ :type="(props.type as SeriesSlugSelected)":averageTotal="props.isShowAverage ? props.averageTotal : undefined"@click="emit('clickAverage')">@@ -123,7 +123,7 @@ function onClick(type: SeriesSlugSelected) {:categoryId:filter:statDate- :statTabSlug="props.type ?? 'netIncome'"+ :statTabSlug="(props.type ?? 'netIncome') as SeriesSlugSelected":trnsIds:walletId/>diff --git a/app/components/stat/useStatItem.ts b/app/components/stat/useStatItem.tsindex 7ce3b2ac..db876551 100644--- a/app/components/stat/useStatItem.ts+++ b/app/components/stat/useStatItem.ts@@ -3,6 +3,7 @@ import type { ComputedRef } from 'vue'import { useStorage } from '@vueuse/core'import { differenceInDays } from 'date-fns'+import type { TotalReturns } from '~/components/amount/getTotal'import type { CategoryId } from '~/components/categories/types'import type { StatDateProvider } from '~/components/date/types'import type { FilterProvider } from '~/components/stat/filter/types'@@ -102,7 +103,7 @@ export function useStatItem({if (differenceInDays(statDate.range.value.end, statDate.range.value.start) < 2)return- const sum = filteredType.value === 'netIncome' ? rangeTotal.value.sum : rangeTotal.value[type.value!]+ const sum = filteredType.value === 'netIncome' ? rangeTotal.value.sum : rangeTotal.value[type.value as keyof TotalReturns] as numberconst dateRange = isIntervalSelected.value? statDate.selectedInterval.valuediff --git a/app/components/stat/utils.ts b/app/components/stat/utils.tsindex a14313db..be6dfb38 100644--- a/app/components/stat/utils.ts+++ b/app/components/stat/utils.ts@@ -1,4 +1,4 @@-import type { SeriesSlugSelected, StatTabSlug } from '~/components/stat/types'+import type { SeriesSlug, SeriesSlugSelected, StatTabSlug } from '~/components/stat/types'import { TrnType } from '~/components/trns/types'@@ -50,7 +50,7 @@ export function getTypesToShow(statTab: StatTabSlug,filteredType: SeriesSlugSelected,type: SeriesSlugSelected | undefined,-): string[] {+): SeriesSlug[] {if (statTab === 'summary') {if (filteredType === 'netIncome')return ['income', 'expense']@@ -63,5 +63,7 @@ export function getTypesToShow(if (statTab === 'expense' || statTab === 'income')return [statTab]- return type ? [type] : ['income', 'expense']+ if (type && type !== 'netIncome')+ return [type]+ return ['income', 'expense']}diff --git a/app/components/theme/Switcher.vue b/app/components/theme/Switcher.vueindex 4121bb00..27cbb08f 100644--- a/app/components/theme/Switcher.vue+++ b/app/components/theme/Switcher.vue@@ -24,7 +24,7 @@ const { options, preference, setTheme } = useTheme()<FormSelect:options:value="preference"- @change="(theme: Theme) => setTheme(theme)"+ @change="(value: string) => setTheme(value as Theme)"/></template>diff --git a/app/components/trnForm/Bottom.vue b/app/components/trnForm/Bottom.vueindex be37568a..9c13f35b 100644--- a/app/components/trnForm/Bottom.vue+++ b/app/components/trnForm/Bottom.vue@@ -46,7 +46,7 @@ onBeforeUnmount(() => {function init() {if (!sliderObj.value) {- sliderObj.value = new Swiper(sliderRef.value, {+ sliderObj.value = new Swiper(sliderRef.value!, {// centeredSlides: true,init: false,initialSlide: 1,@@ -93,7 +93,7 @@ onMounted(init):style="{ height: maxHeight }"><TrnFormTrnsSlide- :slider="sliderObj"+ :slider="sliderObj as any":mainSlideIdx="1"class="overflow-hidden px-2 pt-4 pb-6"/>diff --git a/app/components/trnForm/Calendar.vue b/app/components/trnForm/Calendar.vueindex c265c6a2..23cc3c96 100644--- a/app/components/trnForm/Calendar.vue+++ b/app/components/trnForm/Calendar.vue@@ -27,9 +27,9 @@ function onUpdate(date: CalendarDate) {<template><UCalendar- v-model="date"+ v-model="(date as any)":maxValue="maxDate"class="p-3"- @update:modelValue="onUpdate"+ @update:modelValue="onUpdate as any"/></template>diff --git a/app/components/trnForm/Date.vue b/app/components/trnForm/Date.vueindex 4be7a2e7..1eb13c91 100644--- a/app/components/trnForm/Date.vue+++ b/app/components/trnForm/Date.vue@@ -8,7 +8,7 @@ const { t } = useI18n()const trnsFormStore = useTrnsFormStore()const { formatDate } = useDateFormats()-const formattedDate = computed(() => formatDate(trnsFormStore.values.date, 'full'))+const formattedDate = computed(() => formatDate(trnsFormStore.values.date, 'full') as { day: string, full: string, month: string, week: string, weekday: string } | undefined)const isToday = computed(() => isSameDay(new Date(trnsFormStore.values.date), new Date()))const isShow = ref(false)@@ -37,10 +37,10 @@ function changeDate(way: 'prev' | 'next' | 'today') {<template #trigger><UiActionButton class="text-2 grid w-full !justify-start p-2 text-left"><div class="text-1 text-sm">- {{ formattedDate.day }} {{ formattedDate.month }}+ {{ formattedDate?.day }} {{ formattedDate?.month }}</div><div class="font-regular text-2xs leading-none">- {{ formattedDate.weekday }}+ {{ formattedDate?.weekday }}</div></UiActionButton></template>diff --git a/app/components/trnForm/EditedTrn.vue b/app/components/trnForm/EditedTrn.vueindex 756334da..79963f80 100644--- a/app/components/trnForm/EditedTrn.vue+++ b/app/components/trnForm/EditedTrn.vue@@ -13,7 +13,7 @@ const trnsFormStore = useTrnsFormStore()><TrnsItemv-if="trnsStore.computeTrnItem(trnsFormStore.values.trnId)"- :trnItem="trnsStore.computeTrnItem(trnsFormStore.values.trnId)"+ :trnItem="trnsStore.computeTrnItem(trnsFormStore.values.trnId)!"class="group bg-item-3 rounded-lg"@click="trnsFormStore.values.trnId = null"/>diff --git a/app/components/trnForm/Main.vue b/app/components/trnForm/Main.vueindex f61e30be..1b2a930a 100644--- a/app/components/trnForm/Main.vue+++ b/app/components/trnForm/Main.vue@@ -59,8 +59,8 @@ const walletId = computed(() =><TrnFormSelectorCategoryv-if="trnsFormStore.values.categoryId || categoriesStore.categoriesIdsForTrnValues[0]":bottomSheetStyle="{ maxHeight }"- :category="categoriesStore.items[trnsFormStore.values.categoryId ?? categoriesStore.categoriesIdsForTrnValues[0]]"- :categoryId="trnsFormStore.values.categoryId ?? categoriesStore.categoriesIdsForTrnValues[0]"+ :category="categoriesStore.items[(trnsFormStore.values.categoryId ?? categoriesStore.categoriesIdsForTrnValues[0])!]!"+ :categoryId="(trnsFormStore.values.categoryId ?? categoriesStore.categoriesIdsForTrnValues[0])!":title="t('trnForm.category.select')"@selected="(id: CategoryId) => trnsFormStore.values.categoryId = id"/>diff --git a/app/components/trnForm/SelectionCategoriesFast.vue b/app/components/trnForm/SelectionCategoriesFast.vueindex 0dfc4964..fa1d59e6 100644--- a/app/components/trnForm/SelectionCategoriesFast.vue+++ b/app/components/trnForm/SelectionCategoriesFast.vue@@ -30,7 +30,7 @@ const isShowAllCategoriesFallback = computed(() =></UiTitleCollapse><CategoriesSelectorGrid- :activeItemId="trnsFormStore.values.categoryId"+ :activeItemId="trnsFormStore.values.categoryId ?? undefined":ids="categoriesStore.favoriteCategoriesIds"@@ -45,7 +45,7 @@ const isShowAllCategoriesFallback = computed(() =></UiTitleModal><CategoriesSelectorGrid- :activeItemId="trnsFormStore.values.categoryId"+ :activeItemId="trnsFormStore.values.categoryId ?? undefined":ids="categoriesStore.recentCategoriesIds"@@ -56,7 +56,7 @@ const isShowAllCategoriesFallback = computed(() =><!-- All categories fallback when no favorites and no recent --><div v-if="isShowAllCategoriesFallback"><CategoriesSelectorGrid- :activeItemId="trnsFormStore.values.categoryId"+ :activeItemId="trnsFormStore.values.categoryId ?? undefined":ids="categoriesStore.categoriesIdsForTrnValues"diff --git a/app/components/trnForm/SelectorWallet.vue b/app/components/trnForm/SelectorWallet.vueindex 05eb159d..01611eb8 100644--- a/app/components/trnForm/SelectorWallet.vue+++ b/app/components/trnForm/SelectorWallet.vue@@ -31,7 +31,7 @@ const isShow = ref(false)<template #trigger><WalletsItem:walletId- :wallet="walletsStore.itemsComputed[walletId]"+ :wallet="walletsStore.itemsComputed[walletId]!"insideClasses="!min-h-[46px]"isShowIconisShowCreditLimitdiff --git a/app/components/trnForm/Sidebar.vue b/app/components/trnForm/Sidebar.vueindex 2cd57a34..f82b357c 100644--- a/app/components/trnForm/Sidebar.vue+++ b/app/components/trnForm/Sidebar.vue@@ -18,7 +18,7 @@ const sliderObj = ref<Swiper | null>(null)function init() {if (!sliderObj.value) {- sliderObj.value = new Swiper(sliderRef.value, {+ sliderObj.value = new Swiper(sliderRef.value!, {init: true,initialSlide: 0,longSwipesMs: 60,@@ -88,7 +88,7 @@ watch(isShow, async (v) => {</UiTitleSection><TrnFormTrnsSlide- :slider="sliderObj"+ :slider="sliderObj as any":mainSlideIdx="0"class="px-2 pb-6"/>diff --git a/app/components/trnForm/TrnsSlide.vue b/app/components/trnForm/TrnsSlide.vueindex a71820d5..c0ae0bb1 100644--- a/app/components/trnForm/TrnsSlide.vue+++ b/app/components/trnForm/TrnsSlide.vue@@ -12,8 +12,8 @@ import { useTrnsStore } from '~/components/trns/useTrnsStore'const props = defineProps<{mainSlideIdx: numberslider?: {- slideTo: object | null- }+ slideTo: (index: number, speed?: number) => void+ } | null}>()const { t } = useI18n()@@ -53,7 +53,7 @@ function changeFilter(value: FilterBy) {}function onClickTransaction() {- props.slider?.slideTo(props.mainSlideIdx)+ props.slider?.slideTo(props.mainSlideIdx, 0)}const tabs = computed<{ id: FilterBy, name: string }[]>(() => [diff --git a/app/components/trnForm/useTrnsFormStore.ts b/app/components/trnForm/useTrnsFormStore.tsindex c4c54ec8..ca39177c 100644--- a/app/components/trnForm/useTrnsFormStore.ts+++ b/app/components/trnForm/useTrnsFormStore.ts@@ -140,12 +140,12 @@ export const useTrnsFormStore = defineStore('trnForm', () => {if (props.action === 'create') {values.trnType = 0if (!values.walletId || !props.walletsIds.includes(values.walletId))- values.walletId = props.walletId ?? props.trn?.walletId ?? props.walletsIds[0]+ values.walletId = props.walletId ?? (props.trn && 'walletId' in props.trn ? props.trn.walletId : undefined) ?? props.walletsIds[0] ?? nullif (!values.categoryId || !props.categoriesIds.includes(values.categoryId as CategoryId))- values.categoryId = props.trn?.categoryId ?? props.categoriesIds[0]+ values.categoryId = props.trn?.categoryId ?? props.categoriesIds[0] ?? null- values.incomeWalletId = props.walletsIds[0]- values.expenseWalletId = props.walletsIds[1] ?? props.walletsIds[0]+ values.incomeWalletId = props.walletsIds[0] ?? null+ values.expenseWalletId = props.walletsIds[1] ?? props.walletsIds[0] ?? null}if (props.action === 'edit')@@ -224,7 +224,9 @@ export const useTrnsFormStore = defineStore('trnForm', () => {}function openFormForEdit(trnId: TrnId) {- const trn = trnsStore.items[trnId]+ const trn = trnsStore.items?.[trnId]+ if (!trn)+ returnsetValues({action: 'edit',@@ -240,7 +242,7 @@ export const useTrnsFormStore = defineStore('trnForm', () => {setValues({action: 'create',categoriesIds: categoriesStore.categoriesIdsForTrnValues,- trn: trnsStore.lastCreatedTrnItem,+ trn: trnsStore.lastCreatedTrnItem as TrnItem,walletId: walletsStore.sortedIds[0],walletsIds: walletsStore.sortedIds,})diff --git a/app/components/trnForm/utils/calculate.ts b/app/components/trnForm/utils/calculate.tsindex d01b19a3..ee12835b 100644--- a/app/components/trnForm/utils/calculate.ts+++ b/app/components/trnForm/utils/calculate.ts@@ -71,7 +71,7 @@ export function evaluateExpression(value: string): number {function parseNumber(): number {const start = pos- while (pos < expression.length && ((expression[pos] >= '0' && expression[pos] <= '9') || expression[pos] === '.')) {+ while (pos < expression.length && ((expression[pos]! >= '0' && expression[pos]! <= '9') || expression[pos] === '.')) {pos++}return Number(expression.slice(start, pos)) || 0diff --git a/app/components/trnForm/utils/formatData.test.ts b/app/components/trnForm/utils/formatData.test.tsindex 4f63fc3e..044bcf66 100644--- a/app/components/trnForm/utils/formatData.test.ts+++ b/app/components/trnForm/utils/formatData.test.ts@@ -140,10 +140,12 @@ tests.forEach((test) => {const data = test.id === 'transactions'? formatTransaction(variant.data.expect): formatTransfer(variant.data.expect)- delete data.updatedAt+ if (data)+ delete (data as any).updatedAtconst res = variant.data.become- delete res.updatedAt+ if (res)+ delete (res as any).updatedAtexpect(data).toEqual(res)})diff --git a/app/components/trnForm/utils/validate.test.ts b/app/components/trnForm/utils/validate.test.tsindex d8659c81..534e8af2 100644--- a/app/components/trnForm/utils/validate.test.ts+++ b/app/components/trnForm/utils/validate.test.ts@@ -1,11 +1,13 @@import { describe, expect, it } from 'vitest'+import type { Transaction, Transfer } from '~/components/trns/types'+import { validate } from '~/components/trnForm/utils/validate'import { TrnType } from '~/components/trns/types'const now = Date.now()-const validTransaction = {+const validTransaction: Transaction = {amount: 100,categoryId: 'food',date: now,@@ -14,7 +16,7 @@ const validTransaction = {walletId: 'w1',}-const validTransfer = {+const validTransfer: Transfer = {categoryId: 'transfer' as const,date: now,expenseAmount: 100,diff --git a/app/components/trns/Item.vue b/app/components/trns/Item.vueindex 55a4c050..0ec02d4e 100644--- a/app/components/trns/Item.vue+++ b/app/components/trns/Item.vue@@ -106,8 +106,8 @@ const emit = defineEmits<{<div class="flex flex-wrap gap-2"><Amount- :amount="trnItem.expenseAmount || trnItem.amount"- :colorize="trnItem.incomeAmount === trnItem.expenseAmount ? '' : 'expense'"+ :amount="trnItem.expenseAmount"+ :colorize="trnItem.incomeAmount === trnItem.expenseAmount ? undefined : 'expense'":currencyCode="trnItem.expenseWallet.currency":type="TrnType.Expense"class="!flex items-center gap-2"@@ -116,7 +116,7 @@ const emit = defineEmits<{<template v-if="trnItem.incomeAmount !== trnItem.expenseAmount"><Amount- :amount="trnItem.incomeAmount || trnItem.amount"+ :amount="trnItem.incomeAmount":currencyCode="trnItem.incomeWallet.currency":type="TrnType.Income"colorize="income"diff --git a/app/components/trns/List.vue b/app/components/trns/List.vueindex 5d7cd5d5..efe2afc6 100644--- a/app/components/trns/List.vue+++ b/app/components/trns/List.vue@@ -58,10 +58,10 @@ type TypeFilter = {type: TrnType | undefined}-const typeFilters = computed<TypeFilter[]>(() => {+const typeFilters = computed(() => {const counts = { adjustment: 0, expense: 0, income: 0, transfer: 0 }for (const id of trnsIds) {- const trn = trnsStore.items[id]+ const trn = trnsStore.items?.[id]if (!trn)continueif (trn.categoryId === 'adjustment') {@@ -76,13 +76,14 @@ const typeFilters = computed<TypeFilter[]>(() => {counts.transfer++}- return [+ const filters: TypeFilter[] = [{ count: trnsIds.length, isShow: true, name: t('common.all'), slug: 'all', type: undefined },- { count: counts.expense, isShow: isShowExpense, name: t('money.expense'), slug: 'expense', type: TrnType.Expense },- { count: counts.income, isShow: isShowIncome, name: t('money.income'), slug: 'income', type: TrnType.Income },- { count: counts.transfer, isShow: isShowTransfers, name: t('transfer.titleMoney'), slug: 'transfer', type: TrnType.Transfer },+ { count: counts.expense, isShow: !!isShowExpense, name: t('money.expense'), slug: 'expense', type: TrnType.Expense },+ { count: counts.income, isShow: !!isShowIncome, name: t('money.income'), slug: 'income', type: TrnType.Income },+ { count: counts.transfer, isShow: !!isShowTransfers, name: t('transfer.titleMoney'), slug: 'transfer', type: TrnType.Transfer },{ count: counts.adjustment, isShow: counts.adjustment > 0, name: t('trnForm.adjustmentTitle'), slug: 'adjustment', type: undefined },- ].filter(item => item.isShow)+ ]+ return filters.filter(item => item.isShow)})const selectedTypeFilter = computed(() => {@@ -95,20 +96,20 @@ const filteredByTypeIds = computed(() => {return (trnsIds ?? []).filter((id) => {if (filterBy.value === 'adjustment')- return trnsStore.items[id]?.categoryId === 'adjustment'+ return trnsStore.items?.[id]?.categoryId === 'adjustment'if (filterBy.value === 'transfer')- return trnsStore.items[id]?.type === selectedTypeFilter.value?.type+ return trnsStore.items?.[id]?.type === selectedTypeFilter.value?.type- return trnsStore.items[id]?.type === selectedTypeFilter.value?.type+ return trnsStore.items?.[id]?.type === selectedTypeFilter.value?.type})})-const isTrnsWithDesc = computed(() => filteredByTypeIds.value.some(id => trnsStore.items[id]?.desc))+const isTrnsWithDesc = computed(() => filteredByTypeIds.value.some(id => trnsStore.items?.[id]?.desc))const selectedIds = computed(() => {if (isShowWithDesc.value && isTrnsWithDesc.value)- return filteredByTypeIds.value.filter(id => trnsStore.items[id]?.desc)+ return filteredByTypeIds.value.filter(id => trnsStore.items?.[id]?.desc)return filteredByTypeIds.value})@@ -131,10 +132,11 @@ function setFilterBy(type: TrnsViewType | 'all') {const groupedTrns = computed(() => paginatedTrnsIds.value.reduce((acc, trnId) => {- if (!trnsStore.items?.[trnId]) {+ const trn = trnsStore.items?.[trnId]+ if (!trn) {return acc}- const date = getStartOf(new Date(trnsStore.items[trnId]?.date), 'day').getTime()+ const date = getStartOf(new Date(trn.date), 'day').getTime()if (!acc[date]) {acc[date] = [trnId]}@@ -254,9 +256,9 @@ function onOpenTrnForm(date: number) {<TrnsItemWrapv-if="trnItemsMap.get(trnId)":alt="alt"- :date="formatDate(trnItemsMap.get(trnId)?.date, 'trnItem')"+ :date="(formatDate(trnItemsMap.get(trnId)!.date, 'trnItem') as string)":trnId="trnId"- :trnItem="trnItemsMap.get(trnId)"+ :trnItem="trnItemsMap.get(trnId)!"class="group/trn group"@click="emit('click')"/>@@ -316,8 +318,8 @@ function onOpenTrnForm(date: number) {v-if="trnItemsMap.get(trnId)":alt="alt":trnId="trnId"- :trnItem="trnItemsMap.get(trnId)"- :date="formatDate(trnItemsMap.get(trnId)?.date, 'trnItem')"+ :trnItem="trnItemsMap.get(trnId)!"+ :date="(formatDate(trnItemsMap.get(trnId)!.date, 'trnItem') as string)"class="group"@click="emit('click')"/>diff --git a/app/components/trns/getTrns.ts b/app/components/trns/getTrns.tsindex 4c40514e..68c32914 100644--- a/app/components/trns/getTrns.ts+++ b/app/components/trns/getTrns.ts@@ -25,7 +25,7 @@ export function filterTrnsIds(props: TrnsGetterProps) {return falseif (until && trn.date > until)return false- if (walletsSet && !walletsSet.has(trn.walletId) && !walletsSet.has(trn.expenseWalletId) && !walletsSet.has(trn.incomeWalletId))+ if (walletsSet && !walletsSet.has((trn as any).walletId) && !walletsSet.has((trn as any).expenseWalletId) && !walletsSet.has((trn as any).incomeWalletId))return falseif (categoriesSet && !categoriesSet.has(trn.categoryId))return false@@ -34,7 +34,7 @@ export function filterTrnsIds(props: TrnsGetterProps) {: trnsIdsif (props.sort)- result.sort((a, b) => props.trnsItems?.[b]?.date - props.trnsItems?.[a]?.date)+ result.sort((a, b) => (props.trnsItems?.[b]?.date ?? 0) - (props.trnsItems?.[a]?.date ?? 0))return result}diff --git a/app/components/trns/useTrnsStore.test.ts b/app/components/trns/useTrnsStore.test.tsindex 75d6acaf..e4f6e8e3 100644--- a/app/components/trns/useTrnsStore.test.ts+++ b/app/components/trns/useTrnsStore.test.ts@@ -18,7 +18,7 @@ vi.mock('~~/services/convex/api', () => ({}))const mutationMock = vi.fn(() => Promise.resolve())-const queryMock = vi.fn(() => Promise.resolve(null))+const queryMock = vi.fn<(...args: any[]) => Promise<any>>(() => Promise.resolve(null))const onUpdateMock = vi.fn()vi.stubGlobal('useConvexClientWithApi', () => ({@@ -98,7 +98,7 @@ describe('useTrnsStore', () => {store.saveTrn({ id: 'trn1', values: trn })expect(store.items).toHaveProperty('trn1')- expect(store.items!.trn1.amount).toBe(100)+ expect((store.items!.trn1 as any).amount).toBe(100)})it('saves to localforage', async () => {@@ -177,7 +177,7 @@ describe('useTrnsStore', () => {store.saveTrn({ id: 'trn1', values: makeTrn() })- expect(store.items!.trn1.updatedAt).toBeGreaterThanOrEqual(before)+ expect(store.items!.trn1!.updatedAt).toBeGreaterThanOrEqual(before)})it('shows toast on mutation failure', async () => {@@ -371,7 +371,7 @@ describe('useTrnsStore', () => {const store = useTrnsStore()await store.initTrns()- expect(store.items!.trn1.amount).toBe(200)+ expect((store.items!.trn1 as any).amount).toBe(200)})it('clears store when user has no trns (idsHash returns null)', async () => {diff --git a/app/components/trns/useTrnsStore.ts b/app/components/trns/useTrnsStore.tsindex 0ac1d581..5cc48b81 100644--- a/app/components/trns/useTrnsStore.ts+++ b/app/components/trns/useTrnsStore.ts@@ -31,7 +31,7 @@ async function fetchAllPages<T>(let isDone = falsewhile (!isDone) {- const result = await client.query(queryFn, {+ const result: any = await client.query(queryFn, {...args,paginationOpts: { cursor, numItems: pageSize },})@@ -97,8 +97,8 @@ export const useTrnsStore = defineStore('trns', () => {let latestId: TrnId | undefinedlet latestDate = -1- for (const trnId of Object.keys(items.value)) {- const trn = items.value[trnId]+ for (const trnId of Object.keys(items.value!)) {+ const trn = items.value![trnId]if (!trn || trn.type === TrnType.Transfer || trn.categoryId === 'adjustment')continueif (trn.date > latestDate) {@@ -119,12 +119,12 @@ export const useTrnsStore = defineStore('trns', () => {async function fullSync(retried = false): Promise<void> {const { api, client } = useConvexClientWithApi()- const trns = await fetchAllPages(client, api.trns.list, {})- let data: Trns | null = trns.length ? convexTrnsToMap(trns) : null+ const trns = await fetchAllPages<{ _id: string }>(client, api.trns.list, {})+ let data: Trns | null = trns.length ? convexTrnsToMap(trns as any[]) : null// Verify local hash against server + get server timestamp- const hashResult = await client.query(api.trns.idsHash, {})- const localHash = xorIdsHash(trns.map((t: { _id: string }) => t._id))+ const hashResult = await client.query(api.trns.idsHash, {}) as { hash: string, serverTime: number } | null+ const localHash = xorIdsHash(trns.map(t => t._id))if (hashResult && localHash !== hashResult.hash) {if (!retried) {@@ -155,8 +155,8 @@ export const useTrnsStore = defineStore('trns', () => {// Fetch delta changes and current hash in parallelconst [changedTrns, hashResult] = await Promise.all([- fetchAllPages(client, api.trns.delta, { since: syncMeta.lastSyncedAt }),- client.query(api.trns.idsHash, {}),+ fetchAllPages<{ _id: string }>(client, api.trns.delta, { since: syncMeta.lastSyncedAt }),+ client.query(api.trns.idsHash, {}) as Promise<{ hash: string, serverTime: number } | null>,])if (hashResult === null) {@@ -170,7 +170,7 @@ export const useTrnsStore = defineStore('trns', () => {// Start with cached data and apply deltalet data: Trns = { ...cachedTrns }if (changedTrns.length > 0) {- const changedMap = convexTrnsToMap(changedTrns)+ const changedMap = convexTrnsToMap(changedTrns as any[])data = { ...data, ...changedMap }}@@ -243,7 +243,7 @@ export const useTrnsStore = defineStore('trns', () => {// Optimistic UIsetTrns({ ...(items.value ?? {}), [id]: valuesWithEditDate })- if (!pushSaveOp({ entity: 'trns', id, isDemo: isDemo.value, isExisting: !!isExisting, values: values as unknown as Record<string, unknown> }))+ if (!pushSaveOp({ entity: 'trns', id, isDemo: !!isDemo.value, isExisting: !!isExisting, values: values as unknown as Record<string, unknown> }))returnconst { api, client } = useConvexClientWithApi()@@ -273,8 +273,8 @@ export const useTrnsStore = defineStore('trns', () => {// Fire-and-forget mutation, cleanup on successconst mutation = isExisting- ? client.mutation(api.trns.update, { id: asConvexId<'trns'>(id), ...trnData })- : client.mutation(api.trns.create, trnData)+ ? client.mutation(api.trns.update, { id: asConvexId<'trns'>(id), ...trnData } as any)+ : client.mutation(api.trns.create, trnData as any)return handleMutationResult({action,@@ -293,7 +293,7 @@ export const useTrnsStore = defineStore('trns', () => {delete trns[id]setTrns(trns)- if (!pushDeleteOp({ entity: 'trns', id, isDemo: isDemo.value }))+ if (!pushDeleteOp({ entity: 'trns', id, isDemo: !!isDemo.value }))return// Fire-and-forget mutation, cleanup on success@@ -387,7 +387,7 @@ export const useTrnsStore = defineStore('trns', () => {}return {- cancelPersist: () => debouncedPersist.cancel?.(),+ cancelPersist: () => (debouncedPersist as any).cancel?.(),computeTrnItem,deleteTrn,getRange,diff --git a/app/components/user/useUserStore.test.ts b/app/components/user/useUserStore.test.tsindex e20e52e0..434df669 100644--- a/app/components/user/useUserStore.test.ts+++ b/app/components/user/useUserStore.test.ts@@ -6,7 +6,7 @@ import { ref } from 'vue'// --- Entity-specific mocks ---const mutationMock = vi.fn(() => Promise.resolve())-const queryMock = vi.fn(() => Promise.resolve(null))+const queryMock = vi.fn((): Promise<any> => Promise.resolve(null))vi.stubGlobal('useConvexClientWithApi', () => ({api: {@@ -23,7 +23,7 @@ vi.stubGlobal('useNuxtApp', () => ({$i18n: { setLocale: setLocaleMock },}))-const useSessionMock = vi.fn(() => ref({ data: null, isPending: false }))+const useSessionMock = vi.fn(() => ref({ data: null as any, isPending: false }))vi.stubGlobal('useAuth', () => ({signOut: vi.fn(),useSession: useSessionMock,diff --git a/app/components/wallets/Form.vue b/app/components/wallets/Form.vueindex 218e2f27..0006b50e 100644--- a/app/components/wallets/Form.vue+++ b/app/components/wallets/Form.vue@@ -119,7 +119,7 @@ async function onSave() {<FormSelect:options="walletType":value="props.walletForm.type ?? 'cash'"- @change="(value: WalletType) => emit('update', 'type', value)"+ @change="(value: string) => emit('update', 'type', value as WalletType)"/></div>@@ -131,7 +131,7 @@ async function onSave() {<FormInput:placeholder="t('wallets.form.credit.limit')":modelValue="props.walletForm.creditLimit ?? ''"- @update:modelValue="(value: string) => emit('update', 'creditLimit', +value)"+ @update:modelValue="(value: string) => emit('update', 'creditLimit' as keyof WalletItem, +value)"/></FormElement>diff --git a/app/components/wallets/ItemBody.vue b/app/components/wallets/ItemBody.vueindex c72b1b66..e3817f0d 100644--- a/app/components/wallets/ItemBody.vue+++ b/app/components/wallets/ItemBody.vue@@ -38,12 +38,16 @@ const classes = computed(() => ([const creditViews = ['debt', 'summary'] as constconst activeCreditView = useStorage<typeof creditViews[number]>(props.walletId, 'debt')+const walletCreditLimit = computed(() =>+ props.wallet.type === 'credit' ? props.wallet.creditLimit : 0,+)+const creditAmount = computed(() => {switch (activeCreditView.value) {case 'debt':return props.wallet?.amountcase 'summary':- return Math.abs(props.wallet.creditLimit ?? 0) - Math.abs(props.wallet.amount)+ return Math.abs(walletCreditLimit.value) - Math.abs(props.wallet.amount)default:return 0}@@ -102,11 +106,11 @@ if (!props.isSort) {</div><div- v-if="props.isShowCreditLimit && wallet.type === 'credit' && wallet.creditLimit"+ v-if="props.isShowCreditLimit && wallet.type === 'credit' && walletCreditLimit"class="flex items-center gap-0.5 opacity-70"><Amount- :amount="wallet.creditLimit - Math.abs(wallet.amount)"+ :amount="walletCreditLimit - Math.abs(wallet.amount)":currencyCode="wallet.currency":isShowBaseRate="false":isShowSymbol="false"@@ -123,7 +127,7 @@ if (!props.isSort) {<Amountv-if="wallet.amount !== 0"- :amount="wallet.creditLimit"+ :amount="walletCreditLimit":currencyCode="wallet.currency":isShowBaseRate="false":isShowSymbol="false"@@ -135,7 +139,7 @@ if (!props.isSort) {<div class="pr-1"><Amount- v-if="wallet.creditLimit"+ v-if="walletCreditLimit":amount="creditAmount":currencyCode="wallet.currency":isShowBaseRate="props.isShowBaseRate"@@ -160,7 +164,7 @@ if (!props.isSort) {<div v-if="!isSort"><Amount- v-if="wallet.creditLimit"+ v-if="walletCreditLimit":amount="creditAmount":currencyCode="wallet.currency":isShowBaseRate="false"diff --git a/app/components/wallets/Selector.vue b/app/components/wallets/Selector.vueindex 2ffd56ff..ffd82a3d 100644--- a/app/components/wallets/Selector.vue+++ b/app/components/wallets/Selector.vue@@ -56,7 +56,7 @@ function onClickWallet(walletId: WalletId) {:key="walletId":activeItemId="props.activeItemId || (props.selectedIds?.includes(walletId) ? walletId : null)":walletId- :wallet="walletsStore.itemsComputed[walletId]"+ :wallet="walletsStore.itemsComputed[walletId]!":lineWidth="4"class="group/item"isShowIcondiff --git a/app/components/wallets/Statistics.vue b/app/components/wallets/Statistics.vueindex b75794c9..67fcd46c 100644--- a/app/components/wallets/Statistics.vue+++ b/app/components/wallets/Statistics.vue@@ -23,8 +23,8 @@ const summaryKeys = ['total', 'withdrawal', 'available', 'excludeInTotal', 'archconst typeKeys = ['cash', 'cashless', 'deposit', 'credit', 'crypto', 'debt'] as constconst itemsGrouped = computed(() => [- summaryKeys.map(key => props.counts[key]).filter(i => i.isShow),- typeKeys.map(key => props.counts[key]).filter(i => i.isShow),+ summaryKeys.map(key => props.counts[key]).filter((i): i is NonNullable<typeof i> => !!i?.isShow),+ typeKeys.map(key => props.counts[key]).filter((i): i is NonNullable<typeof i> => !!i?.isShow),])</script>diff --git a/app/components/wallets/grouping.test.ts b/app/components/wallets/grouping.test.tsindex c955daaf..a52880f3 100644--- a/app/components/wallets/grouping.test.ts+++ b/app/components/wallets/grouping.test.ts@@ -68,9 +68,9 @@ describe('buildWalletGroups', () => {if (!result)return- expect(result.cashless.ids).toEqual(['cardRUB', 'cardUSD'])- expect(result.cash.ids).toEqual(['cashRUB', 'cashUSD'])- expect(result.cash.groups).toEqual({})+ expect(result.cashless!.ids).toEqual(['cardRUB', 'cardUSD'])+ expect(result.cash!.ids).toEqual(['cashRUB', 'cashUSD'])+ expect(result.cash!.groups).toEqual({})})it('builds primary groups by currency', () => {@@ -78,8 +78,8 @@ describe('buildWalletGroups', () => {if (!result)return- expect(result.RUB.ids).toEqual(['cardRUB', 'cashRUB'])- expect(result.USD.ids).toEqual(['cardUSD', 'cashUSD', 'creditUSD'])+ expect(result.RUB!.ids).toEqual(['cardRUB', 'cashRUB'])+ expect(result.USD!.ids).toEqual(['cardUSD', 'cashUSD', 'creditUSD'])})it('builds secondary groups: type → currency', () => {@@ -87,9 +87,9 @@ describe('buildWalletGroups', () => {if (!result)return- expect(result.cash.groups).toBeDefined()- expect(result.cash.groups!.RUB).toEqual(['cashRUB'])- expect(result.cash.groups!.USD).toEqual(['cashUSD'])+ expect(result.cash!.groups).toBeDefined()+ expect(result.cash!.groups!.RUB).toEqual(['cashRUB'])+ expect(result.cash!.groups!.USD).toEqual(['cashUSD'])})it('builds secondary groups: currency → type', () => {@@ -97,9 +97,9 @@ describe('buildWalletGroups', () => {if (!result)return- expect(result.USD.groups!.cash).toEqual(['cashUSD'])- expect(result.USD.groups!.cashless).toEqual(['cardUSD'])- expect(result.USD.groups!.credit).toEqual(['creditUSD'])+ expect(result.USD!.groups!.cash).toEqual(['cashUSD'])+ expect(result.USD!.groups!.cashless).toEqual(['cardUSD'])+ expect(result.USD!.groups!.credit).toEqual(['creditUSD'])})})@@ -159,24 +159,24 @@ describe('computeToggleStatus', () => {describe('applyToggle', () => {it('toggles primary group from undefined to false', () => {const result = applyToggle({}, 'type', 'cash')- expect(result.type!.cash.show).toBe(false)+ expect(result.type!.cash!.show).toBe(false)})it('toggles primary group from false to true', () => {const map: WalletsToggleMap = { type: { cash: { show: false } } }const result = applyToggle(map, 'type', 'cash')- expect(result.type!.cash.show).toBe(true)+ expect(result.type!.cash!.show).toBe(true)})it('toggles secondary group from undefined to false', () => {const result = applyToggle({}, 'type', 'cash', 'RUB')- expect(result.type!.cash.groups!.RUB).toBe(false)+ expect(result.type!.cash!.groups!.RUB).toBe(false)})it('toggles secondary group from false to true', () => {const map: WalletsToggleMap = { type: { cash: { groups: { RUB: false } } } }const result = applyToggle(map, 'type', 'cash', 'RUB')- expect(result.type!.cash.groups!.RUB).toBe(true)+ expect(result.type!.cash!.groups!.RUB).toBe(true)})it('does nothing for groupedBy "none"', () => {@@ -196,8 +196,8 @@ describe('applyToggleAll', () => {const status = { isAllOpen: false, isAllOpenInside: false, isAnyOpen: false, isAnyOpenInside: false }const result = applyToggleAll({}, 'type', grouped, false, status)- expect(result.type!.cash.show).toBe(true)- expect(result.type!.cashless.show).toBe(true)+ expect(result.type!.cash!.show).toBe(true)+ expect(result.type!.cashless!.show).toBe(true)})it('closes all primary groups when all are open', () => {@@ -210,8 +210,8 @@ describe('applyToggleAll', () => {const status = { isAllOpen: true, isAllOpenInside: false, isAnyOpen: true, isAnyOpenInside: false }const result = applyToggleAll(map, 'type', grouped, false, status)- expect(result.type!.cash.show).toBe(false)- expect(result.type!.cashless.show).toBe(false)+ expect(result.type!.cash!.show).toBe(false)+ expect(result.type!.cashless!.show).toBe(false)})it('with secondary: opens secondary when primary already open', () => {@@ -224,9 +224,9 @@ describe('applyToggleAll', () => {const status = { isAllOpen: true, isAllOpenInside: false, isAnyOpen: true, isAnyOpenInside: false }const result = applyToggleAll(map, 'type', grouped, true, status)- expect(result.type!.cash.groups!.RUB).toBe(true)- expect(result.type!.cash.groups!.USD).toBe(true)- expect(result.type!.cashless.groups!.RUB).toBe(true)+ expect(result.type!.cash!.groups!.RUB).toBe(true)+ expect(result.type!.cash!.groups!.USD).toBe(true)+ expect(result.type!.cashless!.groups!.RUB).toBe(true)})it('with secondary: closes everything when all open', () => {@@ -239,9 +239,9 @@ describe('applyToggleAll', () => {const status = { isAllOpen: true, isAllOpenInside: true, isAnyOpen: true, isAnyOpenInside: true }const result = applyToggleAll(map, 'type', grouped, true, status)- expect(result.type!.cash.show).toBe(false)- expect(result.type!.cash.groups!.RUB).toBe(false)- expect(result.type!.cashless.show).toBe(false)+ expect(result.type!.cash!.show).toBe(false)+ expect(result.type!.cash!.groups!.RUB).toBe(false)+ expect(result.type!.cashless!.show).toBe(false)})it('does nothing for groupedBy "none"', () => {diff --git a/app/components/wallets/page/List.vue b/app/components/wallets/page/List.vueindex 62453e9e..d500c3b8 100644--- a/app/components/wallets/page/List.vue+++ b/app/components/wallets/page/List.vue@@ -1,7 +1,7 @@<script setup lang="ts">import { useStorage } from '@vueuse/core'-import type { WalletsGroupedBy } from '~/components/wallets/types'+import type { WalletsGroupedBy, WalletType } from '~/components/wallets/types'import { useCurrenciesStore } from '~/components/currencies/useCurrenciesStore'import { useWalletDelete } from '~/components/wallets/useWalletDelete'@@ -134,16 +134,16 @@ function hasGroups(groups: Record<string, unknown> | undefined) {<div class="flex flex-wrap justify-stretch gap-2 @2xl/page:justify-start"><StatSumItem:title="t('money.types.total')"- :amount="counts.total.value"+ :amount="counts.total?.value ?? 0"type="netIncome"- @click="setWalletViewType(counts.total.id)"+ @click="setWalletViewType((counts.total?.id ?? 'total') as WalletType | 'total')"/><StatSumItem- v-if="counts.available.value !== 0 && counts.available.value !== counts.total.value"+ v-if="counts.available?.value !== 0 && counts.available?.value !== counts.total?.value":title="t('money.types.available')"- :amount="counts.available.value"+ :amount="counts.available?.value ?? 0"type="netIncome"- @click="setWalletViewType(counts.available.id)"+ @click="setWalletViewType((counts.available?.id ?? 'isAvailable') as WalletType | 'total')"/></div>@@ -152,7 +152,7 @@ function hasGroups(groups: Record<string, unknown> | undefined) {:activeType="walletViewType":currencyCode="currenciesStore.base":counts="counts"- @click="setWalletViewType"+ @click="(v: string) => setWalletViewType(v as WalletType | 'total')"/></div>diff --git a/app/components/wallets/page/New.vue b/app/components/wallets/page/New.vueindex bf2e81dc..225b04a8 100644--- a/app/components/wallets/page/New.vue+++ b/app/components/wallets/page/New.vue@@ -33,7 +33,7 @@ useHead({<WalletsForm:walletForm="walletForm"@afterSave="() => router.replace('/dashboard')"- @update="(id: keyof WalletItem, value: WalletItem[keyof WalletItem]) => walletForm[id] = value"+ @update="(id: keyof WalletItem, value: WalletItem[keyof WalletItem]) => (walletForm as any)[id] = value"/></UiPage></template>diff --git a/app/components/wallets/page/id/Edit.vue b/app/components/wallets/page/id/Edit.vueindex 14eb2e2c..4cfc0720 100644--- a/app/components/wallets/page/id/Edit.vue+++ b/app/components/wallets/page/id/Edit.vue@@ -32,7 +32,7 @@ useHead({ title: `${t('base.edit')}: ${walletForm.value?.name || t('wallets.form:walletId:walletForm@afterSave="() => router.replace(`/wallets/${walletId}`)"- @update="(key: keyof WalletItem, value: WalletItem[keyof WalletItem]) => walletForm[key] = value"+ @update="(key: keyof WalletItem, value: WalletItem[keyof WalletItem]) => (walletForm as any)[key] = value"/></UiPage></template>diff --git a/app/components/wallets/page/id/Index.vue b/app/components/wallets/page/id/Index.vueindex a637c481..9a1e3685 100644--- a/app/components/wallets/page/id/Index.vue+++ b/app/components/wallets/page/id/Index.vue@@ -65,6 +65,7 @@ useHead({ title: wallet.value?.name })onActivated(() => trnsFormStore.values.walletId = walletId.value)const total = computed(() => walletsStore.itemsComputed[walletId.value]?.amount ?? 0)+const walletCreditLimit = computed(() => wallet.value?.type === 'credit' ? wallet.value.creditLimit : 0)function onClickEdit() {router.push(`/wallets/${walletId.value}/edit`)@@ -169,19 +170,19 @@ async function onDeleteConfirm() {/></div>- <div v-if="wallet.creditLimit" class="flex flex-wrap gap-x-8 gap-y-2 md:max-w-lg">+ <div v-if="walletCreditLimit" class="flex flex-wrap gap-x-8 gap-y-2 md:max-w-lg"><StatSumItemWallet:amount="total":currencyCode="wallet.currency":title="t('wallets.form.credit.debt')"/><StatSumItemWallet- :amount="wallet.creditLimit - (-total)"+ :amount="walletCreditLimit - (-total)":currencyCode="wallet.currency":title="t('wallets.form.credit.available')"/><StatSumItemWallet- :amount="wallet.creditLimit"+ :amount="walletCreditLimit":currencyCode="wallet.currency":title="t('wallets.form.credit.limit')"/>diff --git a/app/components/wallets/useWalletsCounts.test.ts b/app/components/wallets/useWalletsCounts.test.tsindex 23f4db9a..58d86dab 100644--- a/app/components/wallets/useWalletsCounts.test.ts+++ b/app/components/wallets/useWalletsCounts.test.ts@@ -30,10 +30,10 @@ describe('computeWalletCounts', () => {wallets: {},})- expect(result.total.value).toBe(0)- expect(result.cash.value).toBe(0)- expect(result.credit.value).toBe(0)- expect(result.total.isShow).toBe(true)+ expect(result.total!.value).toBe(0)+ expect(result.cash!.value).toBe(0)+ expect(result.credit!.value).toBe(0)+ expect(result.total!.isShow).toBe(true)})it('accumulates cash wallet into total', () => {@@ -49,8 +49,8 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.total.value).toBe(1000)- expect(result.cash.value).toBe(1000)+ expect(result.total!.value).toBe(1000)+ expect(result.cash!.value).toBe(1000)})it('excludes credit wallets from total', () => {@@ -67,8 +67,8 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.total.value).toBe(500)- expect(result.credit.value).toBe(-200)+ expect(result.total!.value).toBe(500)+ expect(result.credit!.value).toBe(-200)})it('puts isExcludeInTotal wallets into excludeInTotal, not total', () => {@@ -85,9 +85,9 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.total.value).toBe(1000)- expect(result.excludeInTotal.value).toBe(300)- expect(result.excludeInTotal.isShow).toBe(true)+ expect(result.total!.value).toBe(1000)+ expect(result.excludeInTotal!.value).toBe(300)+ expect(result.excludeInTotal!.isShow).toBe(true)})it('computes available as withdrawal minus abs(credit)', () => {@@ -104,9 +104,9 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.available.value).toBe(4000)- expect(result.withdrawal.value).toBe(5000)- expect(result.available.isShow).toBe(true)+ expect(result.available!.value).toBe(4000)+ expect(result.withdrawal!.value).toBe(5000)+ expect(result.available!.isShow).toBe(true)})it('converts currencies to base rate', () => {@@ -122,8 +122,8 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.total.value).toBe(100)- expect(result.cash.value).toBe(100)+ expect(result.total!.value).toBe(100)+ expect(result.cash!.value).toBe(100)})it('converts creditPossible to base currency', () => {@@ -139,7 +139,7 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.credit.secondValue).toBe(100)+ expect(result.credit!.secondValue).toBe(100)})it('accumulates creditPossible from multiple credit wallets', () => {@@ -156,7 +156,7 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.credit.secondValue).toBe(8000)+ expect(result.credit!.secondValue).toBe(8000)})it('cash.isShow false when only 1 wallet exists', () => {@@ -172,7 +172,7 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.cash.isShow).toBe(false)+ expect(result.cash!.isShow).toBe(false)})it('cash.isShow false when sum is zero', () => {@@ -188,7 +188,7 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.cash.isShow).toBe(false)+ expect(result.cash!.isShow).toBe(false)})it('archived wallets tracked with isShow', () => {@@ -205,8 +205,8 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.archived.value).toBe(500)- expect(result.archived.isShow).toBe(true)+ expect(result.archived!.value).toBe(500)+ expect(result.archived!.isShow).toBe(true)})it('archived.isShow false when no archived wallets', () => {@@ -222,7 +222,7 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.archived.isShow).toBe(false)+ expect(result.archived!.isShow).toBe(false)})it('skips missing wallets', () => {@@ -234,7 +234,7 @@ describe('computeWalletCounts', () => {wallets: {},})- expect(result.total.value).toBe(0)+ expect(result.total!.value).toBe(0)})it('all wallet types accumulated correctly', () => {@@ -255,15 +255,15 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.cash.value).toBe(100)- expect(result.cashless.value).toBe(200)- expect(result.crypto.value).toBe(300)- expect(result.deposit.value).toBe(400)- expect(result.debt.value).toBe(500)- expect(result.credit.value).toBe(-600)- expect(result.credit.secondValue).toBe(10000)+ expect(result.cash!.value).toBe(100)+ expect(result.cashless!.value).toBe(200)+ expect(result.crypto!.value).toBe(300)+ expect(result.deposit!.value).toBe(400)+ expect(result.debt!.value).toBe(500)+ expect(result.credit!.value).toBe(-600)+ expect(result.credit!.secondValue).toBe(10000)// total = 100+200+300+400+500 = 1500 (credit excluded)- expect(result.total.value).toBe(1500)+ expect(result.total!.value).toBe(1500)})it('isExcludeInTotal credit wallet goes to excludeInTotal, not credit or total', () => {@@ -279,9 +279,9 @@ describe('computeWalletCounts', () => {wallets,})- expect(result.excludeInTotal.value).toBe(-300)- expect(result.total.value).toBe(0)- expect(result.credit.value).toBe(-300)+ expect(result.excludeInTotal!.value).toBe(-300)+ expect(result.total!.value).toBe(0)+ expect(result.credit!.value).toBe(-300)})it('withdrawal wallet with negative amount', () => {@@ -299,7 +299,7 @@ describe('computeWalletCounts', () => {})// available = withdrawal - |credit| = -500 - 1000 = -1500- expect(result.available.value).toBe(-1500)+ expect(result.available!.value).toBe(-1500)})})diff --git a/app/components/wallets/useWalletsStore.test.ts b/app/components/wallets/useWalletsStore.test.tsindex ca0f5a2f..c70ac2cf 100644--- a/app/components/wallets/useWalletsStore.test.ts+++ b/app/components/wallets/useWalletsStore.test.ts@@ -109,7 +109,7 @@ describe('useWalletsStore', () => {store.saveWallet({ id: 'w1', values: makeWallet() })expect(store.items).toHaveProperty('w1')- expect(store.items!.w1.name).toBe('Cash')+ expect(store.items!.w1!.name).toBe('Cash')})it('saves to localforage', async () => {@@ -277,8 +277,8 @@ describe('useWalletsStore', () => {mutationMock.mockReturnValue(new Promise(() => {})) // never resolvesstore.saveWalletsOrder(['w2', 'w1'])- expect(store.items!.w2.order).toBe(0)- expect(store.items!.w1.order).toBe(1)+ expect(store.items!.w2!.order).toBe(0)+ expect(store.items!.w1!.order).toBe(1)})it('fires atomic updateOrder mutation', () => {@@ -327,7 +327,7 @@ describe('useWalletsStore', () => {store.saveWallet({ id: 'w3', values: makeWallet({ order: 0 }) })- expect(store.items!.w3.order).toBe(4)+ expect(store.items!.w3!.order).toBe(4)})it('does not change order for existing wallets', () => {@@ -339,7 +339,7 @@ describe('useWalletsStore', () => {store.saveWallet({ id: 'w1', values: makeWallet({ order: 5 }) })- expect(store.items!.w1.order).toBe(5)+ expect(store.items!.w1!.order).toBe(5)})})})diff --git a/app/components/wallets/useWalletsStore.ts b/app/components/wallets/useWalletsStore.tsindex 181f418a..54c60eb4 100644--- a/app/components/wallets/useWalletsStore.ts+++ b/app/components/wallets/useWalletsStore.ts@@ -73,7 +73,7 @@ export const useWalletsStore = defineStore('wallets', () => {[id]: values,})- if (!pushSaveOp({ entity: 'wallets', id, isDemo: isDemo.value, isExisting: !!isExisting, values: values as unknown as Record<string, unknown> }))+ if (!pushSaveOp({ entity: 'wallets', id, isDemo: !!isDemo.value, isExisting: !!isExisting, values: values as unknown as Record<string, unknown> }))returnconst { api, client } = useConvexClientWithApi()@@ -112,8 +112,9 @@ export const useWalletsStore = defineStore('wallets', () => {// Optimistic updateconst updated = { ...(items.value ?? {}) } as Walletsfor (let i = 0; i < ids.length; i++) {- if (updated[ids[i]])- updated[ids[i]] = { ...updated[ids[i]], order: i }+ const walletId = ids[i]!+ if (updated[walletId])+ updated[walletId] = { ...updated[walletId]!, order: i }}setWallets(updated)@@ -150,7 +151,7 @@ export const useWalletsStore = defineStore('wallets', () => {return []return Object.keys(items.value ?? {}).sort(- (a, b) => items.value[a].order - items.value[b].order,+ (a, b) => (items.value![a]?.order ?? 0) - (items.value![b]?.order ?? 0),)})@@ -166,13 +167,16 @@ export const useWalletsStore = defineStore('wallets', () => {const itemsComputed = computed<WalletsComputed>(() =>sortedIds.value.reduce((acc, id) => {+ const wallet = items.value?.[id]+ if (!wallet)+ return accacc[id] = {- ...items.value[id],+ ...wallet,amount: walletTotals.value.get(id) ?? 0,rate: getAmountInRate({amount: 1,baseCurrencyCode: currenciesStore.base,- currencyCode: items.value?.[id]?.currency,+ currencyCode: wallet.currency,rates: currenciesStore.rates,}),}@@ -192,7 +196,7 @@ export const useWalletsStore = defineStore('wallets', () => {if (trnsIds?.length)trnsStore.removeTrnsFromStore(trnsIds)- if (!pushDeleteOp({ entity: 'wallets', id, isDemo: isDemo.value }))+ if (!pushDeleteOp({ entity: 'wallets', id, isDemo: !!isDemo.value }))return// Fire-and-forget mutation, cleanup on success@@ -209,7 +213,7 @@ export const useWalletsStore = defineStore('wallets', () => {}return {- cancelPersist: () => debouncedPersist.cancel?.(),+ cancelPersist: () => (debouncedPersist as any).cancel?.(),currenciesUsed,deleteWallet,hasItems,diff --git a/app/composables/useStoreSync.test.ts b/app/composables/useStoreSync.test.tsindex 1cb50f7e..35abc192 100644--- a/app/composables/useStoreSync.test.ts+++ b/app/composables/useStoreSync.test.ts@@ -12,10 +12,10 @@ const removeOfflineOpMock = vi.fn().mockResolvedValue(undefined)const removeOfflineOpsMock = vi.fn().mockResolvedValue(undefined)vi.mock('~/components/offline/helpers', () => ({- getOfflineOpsByEntity: (...args: any[]) => getOfflineOpsByEntityMock(...args),- pushOfflineOp: (...args: any[]) => pushOfflineOpMock(...args),- removeOfflineOp: (...args: any[]) => removeOfflineOpMock(...args),- removeOfflineOps: (...args: any[]) => removeOfflineOpsMock(...args),+ getOfflineOpsByEntity: (...args: unknown[]) => getOfflineOpsByEntityMock(...args as []),+ pushOfflineOp: (...args: unknown[]) => pushOfflineOpMock(...args as []),+ removeOfflineOp: (...args: unknown[]) => removeOfflineOpMock(...args as []),+ removeOfflineOps: (...args: unknown[]) => removeOfflineOpsMock(...args as []),}))let isReplayingValue = falsediff --git a/app/composables/useStoreSync.ts b/app/composables/useStoreSync.tsindex b39a4aa8..cffa1e0f 100644--- a/app/composables/useStoreSync.ts+++ b/app/composables/useStoreSync.ts@@ -98,7 +98,7 @@ export async function mergeOfflineOps<T>(if (hasUpdates || hasDeletes) {const merged = { ...data }for (const id of Object.keys(pendingUpdates))- merged[id] = pendingUpdates[id]+ merged[id] = pendingUpdates[id]!for (const id of pendingDeleteIds)delete merged[id]data = merged@@ -129,7 +129,7 @@ export function handleMutationResult<T>(opts: {logger.log(`confirmed ${opts.action}: ${ids.length > 1 ? `${ids.length} items` : ids[0]}`)if (ids.length === 1)- await removeOfflineOp(opts.entity, ids[0])+ await removeOfflineOp(opts.entity, ids[0]!)elseawait removeOfflineOps(opts.entity, ids)@@ -139,7 +139,7 @@ export function handleMutationResult<T>(opts: {const current = opts.items.valueif (current && opts.id in current && opts.id !== convexId) {const { [opts.id]: item, ...rest } = current- const remapped = { ...rest, [convexId]: item }+ const remapped = { ...rest, [convexId]: item } as Record<string, T>opts.items.value = remappedif (!_persistBlocked)localforage.setItem(STORAGE_KEYS[opts.entity], remapped)diff --git a/convex/categories.ts b/convex/categories.tsindex a31f1de4..2e0adcf8 100644--- a/convex/categories.ts+++ b/convex/categories.ts@@ -204,7 +204,7 @@ export const remove = action({let cursor: string | null = nulllet isDone = falsewhile (!isDone) {- const result = await ctx.runMutation(internal.categories.removeTrnsByCategoryPage, {+ const result: { continueCursor: string, isDone: boolean } = await ctx.runMutation(internal.categories.removeTrnsByCategoryPage, {categoryId: id,cursor,userId: user._id,diff --git a/convex/migrate.ts b/convex/migrate.tsindex 6eef26d6..1cdb849d 100644--- a/convex/migrate.ts+++ b/convex/migrate.ts@@ -117,7 +117,7 @@ export const insertCategories = internalMutation({for (const { id, oldParentId } of inserts) {if (oldParentId && idMap[oldParentId]) {- await ctx.db.patch(id as any, { parentId: idMap[oldParentId] })+ await ctx.db.patch(id as any, { parentId: idMap[oldParentId] as any })}}@@ -148,7 +148,7 @@ export const insertUserSettings = internalMutation({userId: v.string(),},handler: async (ctx, args) => {- await ctx.db.insert('userSettings', args)+ await ctx.db.insert('userSettings', args as any)},})diff --git a/convex/wallets.ts b/convex/wallets.tsindex bc45be38..f83facc0 100644--- a/convex/wallets.ts+++ b/convex/wallets.ts@@ -161,7 +161,7 @@ export const remove = action({let cursor: string | null = nulllet isDone = falsewhile (!isDone) {- const result = await ctx.runMutation(internal.wallets.removeTrnsByWalletPage, {+ const result: { continueCursor: string, isDone: boolean } = await ctx.runMutation(internal.wallets.removeTrnsByWalletPage, {cursor,indexName,userId: user._id,diff --git a/nuxt.config.ts b/nuxt.config.tsindex ae7fb770..2addc9f0 100644--- a/nuxt.config.ts+++ b/nuxt.config.ts@@ -1,4 +1,5 @@import process from 'node:process'+import categoryIcons from './app/assets/js/icons.js'export default defineNuxtConfig({diff --git a/services/convex/api.ts b/services/convex/api.tsindex a3704a38..c846d8de 100644--- a/services/convex/api.ts+++ b/services/convex/api.ts@@ -23,7 +23,7 @@ export function convexWalletsToMap(wallets: ConvexDoc[]): Wallets {}export function convexCategoriesToMap(categories: ConvexDoc[]): Categories {- return arrayToMap<CategoryItem>(categories)+ return arrayToMap<CategoryItem>(categories) as Categories}export function convexTrnsToMap(trns: ConvexDoc[]): Trns {