refactor: remove explicit any across admin forms and catalog actions
Local Build and Deploy / deploy (push) Canceled after 40s
Local Build and Deploy / deploy (push) Canceled after 40s
- Type resolveAsChild generically over Base UI render-prop type - Type catalog/rooms/catalog-items Prisma updates with Prisma.*UpdateInput - Type EventForm/PollForm with explicit form-value interfaces - Type EventPrizesManager/PollQuestionsManager with validator input types - All typecheck, lint, and 312 tests pass
This commit is contained in:
1 parent
907a4399d0
commit
3eaffe658d
8 files changed
+61
-23
No files matched your search
@@ -16,7 +16,10 @@ import {
|
||||
} from "@/components/ui/select";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { useServerAction } from "@/hooks/use-server-action";
|
||||
import type { CreateEventInput, UpdateEventInput } from "@/lib/validators/event";
|
||||
import type {
|
||||
CreateEventInput,
|
||||
UpdateEventInput,
|
||||
} from "@/lib/validators/event";
|
||||
|
||||
interface EventType {
|
||||
id: number;
|
||||
@@ -34,8 +37,8 @@ interface EventFormValues {
|
||||
title: string;
|
||||
description: string;
|
||||
image?: string | null;
|
||||
maxPlayers?: string | null;
|
||||
roomId?: string | null;
|
||||
maxPlayers?: string | number | null;
|
||||
roomId?: string | number | null;
|
||||
typeId: number;
|
||||
status: string;
|
||||
isRecurring: number;
|
||||
@@ -60,9 +63,15 @@ export function EventForm({ eventTypes, defaultValues }: EventFormProps) {
|
||||
|
||||
function onSubmit(data: EventFormValues) {
|
||||
if (isEditing && defaultValues?.id) {
|
||||
run(() => updateEvent({ id: defaultValues.id!, ...data } as UpdateEventInput), {
|
||||
successMessage: "Event updated!",
|
||||
});
|
||||
run(
|
||||
() =>
|
||||
updateEvent({ id: defaultValues.id!, ...data } as UpdateEventInput & {
|
||||
id: number;
|
||||
}),
|
||||
{
|
||||
successMessage: "Event updated!",
|
||||
},
|
||||
);
|
||||
} else {
|
||||
run(() => createEvent(data as CreateEventInput), {
|
||||
successMessage: "Event created!",
|
||||
|
||||
@@ -75,9 +75,16 @@ export function PollQuestionsManager({ pollId, questions }: Props) {
|
||||
function handleSubmit(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
if (editingId) {
|
||||
run(() => updatePollQuestion({ id: editingId, ...form } as PollQuestionUpdateInput), {
|
||||
successMessage: "Question updated!",
|
||||
});
|
||||
run(
|
||||
() =>
|
||||
updatePollQuestion({
|
||||
id: editingId,
|
||||
...form,
|
||||
} as PollQuestionUpdateInput),
|
||||
{
|
||||
successMessage: "Question updated!",
|
||||
},
|
||||
);
|
||||
} else {
|
||||
run(() => addPollQuestion(form), {
|
||||
successMessage: "Question added!",
|
||||
|
||||
@@ -50,9 +50,15 @@ export function PollForm({ defaultValues }: PollFormProps) {
|
||||
|
||||
function onSubmit(data: PollFormValues) {
|
||||
if (isEditing) {
|
||||
run(() => updatePoll({ id: defaultValues!.id, ...data } as UpdatePollInput), {
|
||||
successMessage: "Poll updated!",
|
||||
});
|
||||
run(
|
||||
() =>
|
||||
updatePoll({ id: defaultValues!.id, ...data } as UpdatePollInput & {
|
||||
id: number;
|
||||
}),
|
||||
{
|
||||
successMessage: "Poll updated!",
|
||||
},
|
||||
);
|
||||
} else {
|
||||
run(() => createPoll(data as CreatePollInput), {
|
||||
successMessage: "Poll created!",
|
||||
|
||||
Reference in new issue
Block a user