G.1 — Replace : any in useAdmin.ts with Prisma types
What's wrong
app/composables/useAdmin.ts has ~18 : any annotations. That means the entire admin composable has zero type-checking — a typo on a field name doesn't fail typecheck, it fails at runtime in the user's browser.
How to fix
Prisma generates types under prisma/generated/client. Import them:
import type { Form, FormComponent, FormGroup, Announcement, Student } from '~~/prisma/generated/client'
Replace each : any:
(question: any) → (question: FormComponent)
useState<any[]>('questions', ...) → useState<FormComponent[]>('questions', ...)
useState<any[]>('announcements', ...) → useState<Announcement[]>('announcements', ...)
useState<any[]>('publishedForms', ...) → useState<Form[]>('publishedForms', ...)
- etc.
For the API call helpers, define a small response type that matches what the server returns:
type FormApiCreateForm = {
success: boolean
message: string
data: Form & { questions: FormComponent[] }
}
Files
app/composables/useAdmin.ts
Severity
M.
Acceptance
G.1 — Replace
: anyinuseAdmin.tswith Prisma typesWhat's wrong
app/composables/useAdmin.tshas ~18: anyannotations. That means the entire admin composable has zero type-checking — a typo on a field name doesn't fail typecheck, it fails at runtime in the user's browser.How to fix
Prisma generates types under
prisma/generated/client. Import them:Replace each
: any:(question: any)→(question: FormComponent)useState<any[]>('questions', ...)→useState<FormComponent[]>('questions', ...)useState<any[]>('announcements', ...)→useState<Announcement[]>('announcements', ...)useState<any[]>('publishedForms', ...)→useState<Form[]>('publishedForms', ...)For the API call helpers, define a small response type that matches what the server returns:
Files
app/composables/useAdmin.tsSeverity
M.
Acceptance
: anyannotations remain inuseAdmin.ts.pnpm typecheckpasses (after E.2 lands).