chore: fix typecheck on monorepo

- regeneratePlan: switch return type to Promise<void> so it satisfies the
  React form action contract.
- fast.routes PATCH: omit undefined keys instead of passing them, to
  comply with Prisma + exactOptionalPropertyTypes.
- weight-entry-form: cast field value/defaultValues to bypass z.input
  reporting `Date` for `z.coerce.date()` (zod 3.25 still emits the
  target type, not unknown).

pnpm typecheck, lint, test now all green across the monorepo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
lucianoandClaude Opus 4.7 committed 2026-04-29 21:16:08 +02:00
1 parent ad1e4ecaeb
commit cdfc685855
3 files changed
+20 -14

No files matched your search

+4 -5
View File
@@ -42,9 +42,9 @@ export async function fetchCurrentPlan(): Promise<CurrentPlan | null> {
return data.plan;
}
export type RegenerateResult = { ok: true } | { ok: false; error: string };
export async function regeneratePlan(): Promise<RegenerateResult> {
// Server action invocata via `<form action={regeneratePlan}>`. La firma è
// `(FormData) => Promise<void>` per allinearsi al type richiesto da React 18.
export async function regeneratePlan(_formData?: FormData): Promise<void> {
const res = await fetch(`${API_URL}/me/meal-plans`, {
method: 'POST',
headers: { cookie: cookieHeader() },
@@ -52,10 +52,9 @@ export async function regeneratePlan(): Promise<RegenerateResult> {
});
if (!res.ok) {
const body = (await res.json().catch(() => ({}))) as { error?: string };
return { ok: false, error: body.error ?? `api_error_${res.status}` };
throw new Error(body.error ?? `api_error_${res.status}`);
}
revalidatePath('/plan');
return { ok: true };
}
export type SwapResult = { ok: true } | { ok: false; error: string };