From e0d2296904a5d86775e2af484f989b5faba7e766 Mon Sep 17 00:00:00 2001 From: openhands Date: Sat, 4 Oct 2025 20:29:57 +0000 Subject: [PATCH] Fix TypeScript compilation errors - Replace 'any' types with proper types ('unknown' and 'UserData' interface) - Change 'let' to 'const' for immutable variables - Remove unused 'useEffect' import from ErrorAnalyzer component Co-authored-by: openhands --- src/app/api/analyze-errors/route.ts | 4 ++-- src/app/api/submit/route.ts | 10 +++++++++- src/components/ErrorAnalyzer.tsx | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/app/api/analyze-errors/route.ts b/src/app/api/analyze-errors/route.ts index 5869fd4..fc8065e 100644 --- a/src/app/api/analyze-errors/route.ts +++ b/src/app/api/analyze-errors/route.ts @@ -25,7 +25,7 @@ interface AiriaResponse { success: boolean; message?: string; error?: string; - data?: any; + data?: unknown; } interface ErrorAnalysis { @@ -157,7 +157,7 @@ function parseErrorAnalysis(airiaResponse: string, originalError?: string): Erro const lines = airiaResponse.split('\n').filter(line => line.trim()); // Default values - let userFriendlyMessage = airiaResponse; + const userFriendlyMessage = airiaResponse; let severity: 'low' | 'medium' | 'high' | 'critical' = 'medium'; let suggestedActions: string[] = []; let errorCode: string | undefined; diff --git a/src/app/api/submit/route.ts b/src/app/api/submit/route.ts index 73a301a..07c1090 100644 --- a/src/app/api/submit/route.ts +++ b/src/app/api/submit/route.ts @@ -1,5 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +interface UserData { + id: string; + name: string; + email: string; + message: string; + submittedAt: string; +} + export async function POST(request: NextRequest) { try { const body = await request.json(); @@ -60,7 +68,7 @@ export async function POST(request: NextRequest) { } // Simulate a function that could fail in a real application -async function processUserData(userData: any) { +async function processUserData(userData: UserData) { // Simulate a realistic business logic error // This could be a database operation, external API call, or data validation diff --git a/src/components/ErrorAnalyzer.tsx b/src/components/ErrorAnalyzer.tsx index 1bafdca..72b817e 100644 --- a/src/components/ErrorAnalyzer.tsx +++ b/src/components/ErrorAnalyzer.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState, useEffect } from "react"; +import { useState } from "react"; interface ErrorAnalysis { originalError: string;