From 90a15c20cebfd623de1500b66d4e816d25d70512 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Wed, 11 Mar 2026 21:00:24 +0100 Subject: [PATCH] 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 --- frontend/src/components/AvailableBalance.tsx | 5 +++-- frontend/src/lib/palette.test.ts | 2 +- frontend/tsconfig.node.json | 2 +- frontend/vite.config.ts | 3 +-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/AvailableBalance.tsx b/frontend/src/components/AvailableBalance.tsx index 8219671..963a462 100644 --- a/frontend/src/components/AvailableBalance.tsx +++ b/frontend/src/components/AvailableBalance.tsx @@ -16,14 +16,15 @@ export function AvailableBalance({ budget }: Props) { 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.bills'), value: totals.bills_actual, categoryType: 'bill' }, { name: t('dashboard.expenses'), value: totals.expenses_actual, categoryType: 'variable_expense' }, { name: t('dashboard.debts'), value: totals.debts_actual, categoryType: 'debt' }, { name: t('dashboard.savings'), value: totals.savings_actual, categoryType: 'saving' }, { name: t('dashboard.investments'), value: totals.investments_actual, categoryType: 'investment' }, - ].filter((d) => d.value > 0) + ] + const data = allData.filter((d) => d.value > 0) return ( diff --git a/frontend/src/lib/palette.test.ts b/frontend/src/lib/palette.test.ts index 995c356..f22ea4f 100644 --- a/frontend/src/lib/palette.test.ts +++ b/frontend/src/lib/palette.test.ts @@ -1,7 +1,7 @@ import { describe, it, expect } from 'vitest' import { palette, - CategoryType, + type CategoryType, headerGradient, overviewHeaderGradient, amountColorClass, diff --git a/frontend/tsconfig.node.json b/frontend/tsconfig.node.json index 8a67f62..7f82ae3 100644 --- a/frontend/tsconfig.node.json +++ b/frontend/tsconfig.node.json @@ -4,7 +4,7 @@ "target": "ES2023", "lib": ["ES2023"], "module": "ESNext", - "types": ["node"], + "types": ["node", "vitest/globals"], "skipLibCheck": true, /* Bundler mode */ diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index d1cef3e..ee372a8 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,5 +1,4 @@ -/// -import { defineConfig } from 'vite' +import { defineConfig } from 'vitest/config' import react from '@vitejs/plugin-react' import tailwindcss from '@tailwindcss/vite' import path from 'path'