Implement strict type enforcement plan

This commit is contained in:
gpt-engineer-app[bot]
2025-10-16 14:10:35 +00:00
parent 3bcd9e03fa
commit bc4a444138
25 changed files with 161 additions and 132 deletions

View File

@@ -114,12 +114,12 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
// Operator state
const [selectedOperatorId, setSelectedOperatorId] = useState<string>(initialData?.operator_id || '');
const [tempNewOperator, setTempNewOperator] = useState<any>(null);
const [tempNewOperator, setTempNewOperator] = useState<{ name: string; slug: string; company_type: string } | null>(null);
const [isOperatorModalOpen, setIsOperatorModalOpen] = useState(false);
// Property Owner state
const [selectedPropertyOwnerId, setSelectedPropertyOwnerId] = useState<string>(initialData?.property_owner_id || '');
const [tempNewPropertyOwner, setTempNewPropertyOwner] = useState<any>(null);
const [tempNewPropertyOwner, setTempNewPropertyOwner] = useState<{ name: string; slug: string; company_type: string } | null>(null);
const [isPropertyOwnerModalOpen, setIsPropertyOwnerModalOpen] = useState(false);
// Fetch data

View File

@@ -6,9 +6,10 @@ import { Badge } from '@/components/ui/badge';
import { Loader2 } from 'lucide-react';
import { format } from 'date-fns';
import { handleError } from '@/lib/errorHandler';
import { AuditLogEntry } from '@/types/database';
export function ProfileAuditLog() {
const [logs, setLogs] = useState<any[]>([]);
const [logs, setLogs] = useState<AuditLogEntry[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
@@ -27,7 +28,7 @@ export function ProfileAuditLog() {
.limit(50);
if (error) throw error;
setLogs(data || []);
setLogs((data || []) as AuditLogEntry[]);
} catch (error) {
handleError(error, { action: 'Load audit logs' });
} finally {
@@ -64,13 +65,13 @@ export function ProfileAuditLog() {
{logs.map((log) => (
<TableRow key={log.id}>
<TableCell>
{log.profiles?.display_name || log.profiles?.username || 'Unknown'}
{(log as { profiles?: { display_name?: string; username?: string } }).profiles?.display_name || (log as { profiles?: { username?: string } }).profiles?.username || 'Unknown'}
</TableCell>
<TableCell>
<Badge variant="secondary">{log.action}</Badge>
</TableCell>
<TableCell>
<pre className="text-xs">{JSON.stringify(log.changes, null, 2)}</pre>
<pre className="text-xs">{JSON.stringify(log.changes || {}, null, 2)}</pre>
</TableCell>
<TableCell className="text-sm text-muted-foreground">
{format(new Date(log.created_at), 'PPpp')}

View File

@@ -134,9 +134,9 @@ export function RideForm({ onSubmit, onCancel, initialData, isEditing = false }:
const [isModelModalOpen, setIsModelModalOpen] = useState(false);
// Advanced editor state
const [technicalSpecs, setTechnicalSpecs] = useState<any[]>([]);
const [coasterStats, setCoasterStats] = useState<any[]>([]);
const [formerNames, setFormerNames] = useState<any[]>([]);
const [technicalSpecs, setTechnicalSpecs] = useState<RideTechnicalSpec[]>([]);
const [coasterStats, setCoasterStats] = useState<RideCoasterStat[]>([]);
const [formerNames, setFormerNames] = useState<RideNameHistory[]>([]);
// Fetch data
const { manufacturers, loading: manufacturersLoading } = useManufacturers();

View File

@@ -65,7 +65,7 @@ export function RideModelForm({
initialData
}: RideModelFormProps) {
const { isModerator } = useUserRole();
const [technicalSpecs, setTechnicalSpecs] = useState<any[]>([]);
const [technicalSpecs, setTechnicalSpecs] = useState<RideModelTechnicalSpec[]>([]);
const {
register,