From abbf886483065468c827b2e9867072ff82ff1ce5 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Thu, 29 Jan 2026 22:00:14 -0600 Subject: [PATCH] fix: resolve TypeScript errors in migrated components --- MIGRATION_ERRORS.md | 50 +++ apps/api/package.json | 7 +- apps/web/package.json | 4 +- .../(authenticated)/settings/domains/page.tsx | 4 +- .../settings/personalities/page.tsx | 2 +- apps/web/src/app/demo/gantt/page.tsx | 2 +- apps/web/src/components/chat/Chat.tsx | 4 +- apps/web/src/components/chat/MessageList.tsx | 2 +- .../src/components/domains/DomainFilter.tsx | 2 +- .../web/src/components/domains/DomainItem.tsx | 2 +- .../web/src/components/domains/DomainList.tsx | 2 +- .../src/components/domains/DomainSelector.tsx | 2 +- apps/web/src/components/gantt/GanttChart.tsx | 2 +- .../web/src/components/kanban/KanbanBoard.tsx | 2 +- .../src/components/kanban/KanbanColumn.tsx | 2 +- apps/web/src/components/kanban/TaskCard.tsx | 2 +- apps/web/src/components/kanban/index.ts | 6 +- .../src/components/mindmap/MindmapViewer.tsx | 10 +- .../components/mindmap/ReactFlowEditor.tsx | 6 +- .../personalities/PersonalityForm.tsx | 2 +- .../personalities/PersonalityPreview.tsx | 2 +- .../personalities/PersonalitySelector.tsx | 2 +- apps/web/src/components/ui/alert-dialog.tsx | 121 +++++++ apps/web/src/components/ui/badge.tsx | 22 ++ apps/web/src/components/ui/button.tsx | 26 ++ apps/web/src/components/ui/card.tsx | 22 ++ apps/web/src/components/ui/input.tsx | 2 + apps/web/src/components/ui/label.tsx | 17 + apps/web/src/components/ui/select.tsx | 102 ++++++ apps/web/src/components/ui/switch.tsx | 28 ++ apps/web/src/components/ui/textarea.tsx | 2 + apps/web/src/lib/auth-client.ts | 9 +- apps/web/tsconfig.json | 4 +- packages/shared/src/types/database.types.ts | 16 + packages/shared/src/types/enums.ts | 8 + pnpm-lock.yaml | 303 +++++++++++++++++- 36 files changed, 758 insertions(+), 43 deletions(-) create mode 100644 MIGRATION_ERRORS.md create mode 100644 apps/web/src/components/ui/alert-dialog.tsx create mode 100644 apps/web/src/components/ui/badge.tsx create mode 100644 apps/web/src/components/ui/button.tsx create mode 100644 apps/web/src/components/ui/card.tsx create mode 100644 apps/web/src/components/ui/input.tsx create mode 100644 apps/web/src/components/ui/label.tsx create mode 100644 apps/web/src/components/ui/select.tsx create mode 100644 apps/web/src/components/ui/switch.tsx create mode 100644 apps/web/src/components/ui/textarea.tsx diff --git a/MIGRATION_ERRORS.md b/MIGRATION_ERRORS.md new file mode 100644 index 0000000..3705c9e --- /dev/null +++ b/MIGRATION_ERRORS.md @@ -0,0 +1,50 @@ +# Jarvis FE Migration Errors Summary + +## Web App Errors + +### 1. Missing Dependencies +- `socket.io-client` - needed for WebSocketProvider +- `better-auth` and `better-auth-credentials-plugin/client` - needed for auth-client + +### 2. Missing UI Component Imports +Components using `@/components/ui/*` but should use `@mosaic/ui`: +- `@/components/ui/button` → `@mosaic/ui` (Button exists) +- `@/components/ui/input` → `@mosaic/ui` (Input exists) +- `@/components/ui/textarea` → `@mosaic/ui` (Textarea exists) +- `@/components/ui/select` → `@mosaic/ui` (Select exists) +- `@/components/ui/card` → `@mosaic/ui` (Card exists) +- `@/components/ui/badge` → `@mosaic/ui` (Badge exists) +- `@/components/ui/label` → needs to be created or imported from another source +- `@/components/ui/switch` → needs to be created or imported from another source +- `@/components/ui/alert-dialog` → needs to be created or imported from another source + +### 3. Missing Type Exports from @mosaic/shared +- `Personality` type not exported +- `FormalityLevel` type not exported + +### 4. TypeScript strict mode errors (exactOptionalPropertyTypes) +Multiple errors related to passing `Type | undefined` where `Type` is expected + +### 5. Missing utility exports +- `@mosaic/ui/lib/utils` import fails (cn utility function) + +## API App Errors + +### 1. Missing Dependencies +- `ollama` - LLM service +- `@nestjs/websockets` - WebSocket support +- `socket.io` - WebSocket server +- `@nestjs/mapped-types` - DTO utilities + +### 2. Prisma Client Not Generated +All Prisma-related errors stem from missing generated client + +## Resolution Plan + +1. ✅ Generate Prisma client +2. ✅ Add missing dependencies +3. ✅ Fix UI component imports +4. ✅ Add missing type exports +5. ✅ Fix TypeScript strict mode errors +6. ✅ Create missing UI components +7. ✅ Test build diff --git a/apps/api/package.json b/apps/api/package.json index 56a2245..7c4c062 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -30,7 +30,10 @@ "@mosaic/shared": "workspace:*", "@nestjs/common": "^11.1.12", "@nestjs/core": "^11.1.12", + "@nestjs/mapped-types": "^2.1.0", "@nestjs/platform-express": "^11.1.12", + "@nestjs/platform-socket.io": "^11.1.12", + "@nestjs/websockets": "^11.1.12", "@prisma/client": "^6.19.2", "@types/marked": "^6.0.0", "better-auth": "^1.4.17", @@ -40,10 +43,12 @@ "marked": "^17.0.1", "marked-gfm-heading-id": "^4.1.3", "marked-highlight": "^2.2.3", + "ollama": "^0.6.3", "reflect-metadata": "^0.2.2", "rxjs": "^7.8.1", "sanitize-html": "^2.17.0", - "slugify": "^1.6.6" + "slugify": "^1.6.6", + "socket.io": "^4.8.3" }, "devDependencies": { "@better-auth/cli": "^1.4.17", diff --git a/apps/web/package.json b/apps/web/package.json index 959dd12..7186162 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -22,6 +22,7 @@ "@mosaic/ui": "workspace:*", "@tanstack/react-query": "^5.90.20", "@xyflow/react": "^12.5.3", + "better-auth": "^1.4.17", "date-fns": "^4.1.0", "elkjs": "^0.9.3", "lucide-react": "^0.563.0", @@ -29,7 +30,8 @@ "next": "^16.1.6", "react": "^19.0.0", "react-dom": "^19.0.0", - "react-grid-layout": "^2.2.2" + "react-grid-layout": "^2.2.2", + "socket.io-client": "^4.8.3" }, "devDependencies": { "@mosaic/config": "workspace:*", diff --git a/apps/web/src/app/(authenticated)/settings/domains/page.tsx b/apps/web/src/app/(authenticated)/settings/domains/page.tsx index 3c68fc1..c48db55 100644 --- a/apps/web/src/app/(authenticated)/settings/domains/page.tsx +++ b/apps/web/src/app/(authenticated)/settings/domains/page.tsx @@ -3,9 +3,9 @@ import { useState, useEffect } from "react"; import type { Domain } from "@mosaic/shared"; import { DomainList } from "@/components/domains/DomainList"; -import { fetchDomains, createDomain, updateDomain, deleteDomain } from "@/lib/api/domains"; +import { fetchDomains, deleteDomain } from "@/lib/api/domains"; -export default function DomainsPage(): JSX.Element { +export default function DomainsPage(): React.ReactElement { const [domains, setDomains] = useState([]); const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); diff --git a/apps/web/src/app/(authenticated)/settings/personalities/page.tsx b/apps/web/src/app/(authenticated)/settings/personalities/page.tsx index c8c29a5..be24f78 100644 --- a/apps/web/src/app/(authenticated)/settings/personalities/page.tsx +++ b/apps/web/src/app/(authenticated)/settings/personalities/page.tsx @@ -25,7 +25,7 @@ import { AlertDialogTitle, } from "@/components/ui/alert-dialog"; -export default function PersonalitiesPage(): JSX.Element { +export default function PersonalitiesPage(): React.ReactElement { const [personalities, setPersonalities] = useState([]); const [selectedPersonality, setSelectedPersonality] = useState(null); const [isLoading, setIsLoading] = useState(true); diff --git a/apps/web/src/app/demo/gantt/page.tsx b/apps/web/src/app/demo/gantt/page.tsx index 73638dd..5f44cad 100644 --- a/apps/web/src/app/demo/gantt/page.tsx +++ b/apps/web/src/app/demo/gantt/page.tsx @@ -11,7 +11,7 @@ import { TaskStatus, TaskPriority, type Task } from "@mosaic/shared"; * This page demonstrates the GanttChart component with sample data * showing various task states, durations, and interactions. */ -export default function GanttDemoPage(): JSX.Element { +export default function GanttDemoPage(): React.ReactElement { // Sample tasks for demonstration const baseTasks: Task[] = [ { diff --git a/apps/web/src/components/chat/Chat.tsx b/apps/web/src/components/chat/Chat.tsx index e980910..29dfeb1 100644 --- a/apps/web/src/components/chat/Chat.tsx +++ b/apps/web/src/components/chat/Chat.tsx @@ -217,12 +217,12 @@ export const Chat = forwardRef(function Chat({ // Show a witty loading message after 3 seconds const quipTimerId = setTimeout(() => { - setLoadingQuip(getRandomQuip(WAITING_QUIPS)); + setLoadingQuip(getRandomQuip(WAITING_QUIPS) ?? null); }, 3000); // Change quip every 5 seconds if still waiting const quipIntervalId = setInterval(() => { - setLoadingQuip(getRandomQuip(WAITING_QUIPS)); + setLoadingQuip(getRandomQuip(WAITING_QUIPS) ?? null); }, 5000); try { diff --git a/apps/web/src/components/chat/MessageList.tsx b/apps/web/src/components/chat/MessageList.tsx index fa6bf6b..a647462 100644 --- a/apps/web/src/components/chat/MessageList.tsx +++ b/apps/web/src/components/chat/MessageList.tsx @@ -45,7 +45,7 @@ export function MessageList({ messages, isLoading, loadingQuip }: MessageListPro ))} - {isLoading && } + {isLoading && } ); } diff --git a/apps/web/src/components/domains/DomainFilter.tsx b/apps/web/src/components/domains/DomainFilter.tsx index 3e2e60b..de79a02 100644 --- a/apps/web/src/components/domains/DomainFilter.tsx +++ b/apps/web/src/components/domains/DomainFilter.tsx @@ -12,7 +12,7 @@ export function DomainFilter({ domains, selectedDomain, onFilterChange, -}: DomainFilterProps): JSX.Element { +}: DomainFilterProps): React.ReactElement { return (