From dc5ab9900555777d5cb5eb34b674d5d373f9a31c Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Sun, 23 Nov 2025 16:16:36 -0800 Subject: [PATCH] refactor: enhance type safety in ProfileEditor by defining ProfileFormValues interface --- src/components/ProfileEditor.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/ProfileEditor.tsx b/src/components/ProfileEditor.tsx index 5e0762b..b00db5c 100644 --- a/src/components/ProfileEditor.tsx +++ b/src/components/ProfileEditor.tsx @@ -5,13 +5,21 @@ import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; import { Input } from "@/components/ui/input"; import { api } from "../../convex/_generated/api"; +import type { Doc } from "../../convex/_generated/dataModel"; import modulesData from "../../convex/modules.json"; import { TARGETS } from "../constants/targets"; import { VERSIONS } from "../constants/versions"; import { ModuleCard } from "./ModuleCard"; +interface ProfileFormValues { + name: string; + targets: string[]; + config: Record; + version: string; +} + interface ProfileEditorProps { - initialData?: any; + initialData?: Doc<"profiles">; onSave: () => void; onCancel: () => void; } @@ -76,7 +84,7 @@ export default function ProfileEditor({ } }; - const onSubmit = async (data: any) => { + const onSubmit = async (data: ProfileFormValues) => { if (initialData?._id) { await updateProfile({ id: initialData._id, @@ -127,7 +135,7 @@ export default function ProfileEditor({
- +
Targets
{/* Category Pills */}