Fix: Resolve remaining TypeScript errors

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 02:54:43 +00:00
parent 07420a67bf
commit 516f7c4c41
14 changed files with 49 additions and 49 deletions

View File

@@ -56,7 +56,7 @@ export const performanceTestSuite: TestSuite = {
// Set performance thresholds (in milliseconds)
const threshold = 1000; // 1 second
const warnings = [];
const warnings: string[] = [];
if (parksDuration > threshold) {
warnings.push(`Parks query slow: ${parksDuration}ms`);
@@ -229,7 +229,7 @@ export const performanceTestSuite: TestSuite = {
// Performance threshold: 200ms for simple functions
const threshold = 200;
const warnings = [];
const warnings: string[] = [];
if (modDuration > threshold) {
warnings.push(`is_moderator slow: ${modDuration}ms`);

View File

@@ -347,7 +347,7 @@ export const submissionTestSuite: TestSuite = {
}
// Verify version was created with images
let version = null;
let version: any = null;
const pollStart = Date.now();
while (!version && Date.now() - pollStart < 5000) {
const { data } = await supabase

View File

@@ -72,16 +72,16 @@ export const unitConversionTestSuite: TestSuite = {
// Validate values are stored in metric
const tolerance = 0.01; // Allow small floating point differences
if (Math.abs(ride.max_speed_kmh - testData.max_speed_kmh) > tolerance) {
if (Math.abs((ride.max_speed_kmh ?? 0) - testData.max_speed_kmh) > tolerance) {
throw new Error(`max_speed_kmh mismatch: expected ${testData.max_speed_kmh}, got ${ride.max_speed_kmh}`);
}
if (Math.abs(ride.max_height_meters - testData.max_height_meters) > tolerance) {
if (Math.abs((ride.max_height_meters ?? 0) - testData.max_height_meters) > tolerance) {
throw new Error(`max_height_meters mismatch: expected ${testData.max_height_meters}, got ${ride.max_height_meters}`);
}
if (Math.abs(ride.length_meters - testData.length_meters) > tolerance) {
if (Math.abs((ride.length_meters ?? 0) - testData.length_meters) > tolerance) {
throw new Error(`length_meters mismatch: expected ${testData.length_meters}, got ${ride.length_meters}`);
}
if (Math.abs(ride.height_requirement - testData.height_requirement) > tolerance) {
if (Math.abs((ride.height_requirement ?? 0) - testData.height_requirement) > tolerance) {
throw new Error(`height_requirement mismatch: expected ${testData.height_requirement} cm, got ${ride.height_requirement}`);
}
@@ -172,7 +172,7 @@ export const unitConversionTestSuite: TestSuite = {
tracker.track('rides', rideId);
// Poll for version creation
let version = null;
let version: any = null;
const pollStart = Date.now();
while (!version && Date.now() - pollStart < 5000) {
const { data } = await supabase
@@ -193,13 +193,13 @@ export const unitConversionTestSuite: TestSuite = {
// Validate version has metric units
const tolerance = 0.01;
if (Math.abs(version.max_speed_kmh - 120.0) > tolerance) {
if (Math.abs((version.max_speed_kmh ?? 0) - 120.0) > tolerance) {
throw new Error(`Version max_speed_kmh mismatch: expected 120.0, got ${version.max_speed_kmh}`);
}
if (Math.abs(version.height_meters - 60.0) > tolerance) {
if (Math.abs((version.height_meters ?? 0) - 60.0) > tolerance) {
throw new Error(`Version height_meters mismatch: expected 60.0, got ${version.height_meters}`);
}
if (Math.abs(version.height_requirement_cm - 140) > tolerance) {
if (Math.abs((version.height_requirement_cm ?? 0) - 140) > tolerance) {
throw new Error(`Version height_requirement_cm mismatch: expected 140, got ${version.height_requirement_cm}`);
}

View File

@@ -43,7 +43,7 @@ export const versioningTestSuite: TestSuite = {
parkId = park.id;
// Poll for version creation
let v1 = null;
let v1: any = null;
const pollStart = Date.now();
while (!v1 && Date.now() - pollStart < 5000) {
const { data } = await supabase
@@ -243,7 +243,7 @@ export const versioningTestSuite: TestSuite = {
parkId = park.id;
// Poll for version creation
let v1 = null;
let v1: any = null;
const pollStart = Date.now();
while (!v1 && Date.now() - pollStart < 5000) {
const { data } = await supabase

View File

@@ -347,8 +347,8 @@ class NotificationService {
return (data || []).map(t => ({
...t,
is_active: t.is_active ?? true,
description: t.description || undefined,
novu_workflow_id: t.novu_workflow_id || undefined
description: t.description || null,
novu_workflow_id: t.novu_workflow_id || null,
}));
} catch (error: unknown) {
logger.error('Error fetching notification templates', {

View File

@@ -110,7 +110,7 @@ async function logRequestMetadata(metadata: RequestMetadata): Promise<void> {
// Safe cast - RPC function exists in database
const { error } = await supabase.rpc('log_request_metadata' as 'log_request_metadata', {
p_request_id: metadata.requestId,
p_user_id: metadata.userId || null,
p_user_id: metadata.userId ?? undefined,
p_endpoint: metadata.endpoint,
p_method: metadata.method,
p_status_code: metadata.statusCode,

View File

@@ -1450,7 +1450,7 @@ export async function checkSubmissionConflict(
},
serverVersion: {
last_modified_at: data.last_modified_at,
last_modified_by: data.last_modified_by,
last_modified_by: (data.last_modified_by ?? undefined) as string,
modified_by_profile: data.profiles as any,
},
};