From 0c96bb676d0aec05e4d171cd3a1799bf6212483e Mon Sep 17 00:00:00 2001 From: openhands Date: Sat, 4 Oct 2025 20:24:41 +0000 Subject: [PATCH] Fix TypeScript errors: replace 'any' types with proper interfaces - Added UserData and ProcessedUserData interfaces in submit route - Changed AiriaResponse data field from 'any' to 'unknown' - Fixed prefer-const eslint warning in analyze-errors route - Build now completes successfully without TypeScript errors Co-authored-by: openhands --- src/app/api/analyze-errors/route.ts | 4 ++-- src/app/api/submit/route.ts | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/app/api/analyze-errors/route.ts b/src/app/api/analyze-errors/route.ts index cae93f4..d84c58b 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..71f7306 100644 --- a/src/app/api/submit/route.ts +++ b/src/app/api/submit/route.ts @@ -1,5 +1,18 @@ import { NextRequest, NextResponse } from "next/server"; +interface UserData { + id: string; + name: string; + email: string; + message: string; + submittedAt: string; +} + +interface ProcessedUserData extends UserData { + processedAt: string; + status: string; +} + export async function POST(request: NextRequest) { try { const body = await request.json(); @@ -60,7 +73,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): Promise { // Simulate a realistic business logic error // This could be a database operation, external API call, or data validation