fix(01-02): resolve TypeScript build errors for production build

- Fix palette.test.ts: use type-only import for CategoryType (verbatimModuleSyntax)
- Fix vite.config.ts: import defineConfig from vitest/config for test property support
- Fix tsconfig.node.json: add vitest/globals to types array
- Fix AvailableBalance.tsx: split typed array and filter to preserve CategoryType literal
This commit is contained in:
2026-03-11 21:00:24 +01:00
parent 07041aed34
commit 90a15c20ce
4 changed files with 6 additions and 6 deletions

View File

@@ -16,14 +16,15 @@ export function AvailableBalance({ budget }: Props) {
const available = totals.available const available = totals.available
const data: Array<{ name: string; value: number; categoryType: CategoryType }> = [ const allData: Array<{ name: string; value: number; categoryType: CategoryType }> = [
{ name: t('dashboard.remaining'), value: Math.max(0, available), categoryType: 'carryover' }, { name: t('dashboard.remaining'), value: Math.max(0, available), categoryType: 'carryover' },
{ name: t('dashboard.bills'), value: totals.bills_actual, categoryType: 'bill' }, { name: t('dashboard.bills'), value: totals.bills_actual, categoryType: 'bill' },
{ name: t('dashboard.expenses'), value: totals.expenses_actual, categoryType: 'variable_expense' }, { name: t('dashboard.expenses'), value: totals.expenses_actual, categoryType: 'variable_expense' },
{ name: t('dashboard.debts'), value: totals.debts_actual, categoryType: 'debt' }, { name: t('dashboard.debts'), value: totals.debts_actual, categoryType: 'debt' },
{ name: t('dashboard.savings'), value: totals.savings_actual, categoryType: 'saving' }, { name: t('dashboard.savings'), value: totals.savings_actual, categoryType: 'saving' },
{ name: t('dashboard.investments'), value: totals.investments_actual, categoryType: 'investment' }, { name: t('dashboard.investments'), value: totals.investments_actual, categoryType: 'investment' },
].filter((d) => d.value > 0) ]
const data = allData.filter((d) => d.value > 0)
return ( return (
<Card> <Card>

View File

@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest' import { describe, it, expect } from 'vitest'
import { import {
palette, palette,
CategoryType, type CategoryType,
headerGradient, headerGradient,
overviewHeaderGradient, overviewHeaderGradient,
amountColorClass, amountColorClass,

View File

@@ -4,7 +4,7 @@
"target": "ES2023", "target": "ES2023",
"lib": ["ES2023"], "lib": ["ES2023"],
"module": "ESNext", "module": "ESNext",
"types": ["node"], "types": ["node", "vitest/globals"],
"skipLibCheck": true, "skipLibCheck": true,
/* Bundler mode */ /* Bundler mode */

View File

@@ -1,5 +1,4 @@
/// <reference types="vitest" /> import { defineConfig } from 'vitest/config'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react' import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite' import tailwindcss from '@tailwindcss/vite'
import path from 'path' import path from 'path'