diff --git a/packages/conform-dom/form.ts b/packages/conform-dom/form.ts index e52ebf62..a37fb879 100644 --- a/packages/conform-dom/form.ts +++ b/packages/conform-dom/form.ts @@ -116,7 +116,7 @@ export type FormOptions = { form: HTMLFormElement; submitter: HTMLInputElement | HTMLButtonElement | null; formData: FormData; - }) => Submission; + }) => Submission; }; export type SubscriptionSubject = { diff --git a/packages/conform-dom/submission.ts b/packages/conform-dom/submission.ts index cadee389..65ffa869 100644 --- a/packages/conform-dom/submission.ts +++ b/packages/conform-dom/submission.ts @@ -16,11 +16,11 @@ export type SubmissionContext = { state: SubmissionState; }; -export type Submission = +export type Submission = | { type: 'submit'; payload: Record; - value: Output | null; + value: Value | null; error: Record; reject(options?: RejectOptions): SubmissionResult; accept(options?: AcceptOptions): SubmissionResult; diff --git a/packages/conform-zod/parse.ts b/packages/conform-zod/parse.ts index 1d85849c..35aade7d 100644 --- a/packages/conform-zod/parse.ts +++ b/packages/conform-zod/parse.ts @@ -8,11 +8,12 @@ import { import { type IssueData, type SafeParseReturnType, - type output, type RefinementCtx, type ZodTypeAny, type ZodError, type ZodErrorMap, + type input, + type output, ZodIssueCode, } from 'zod'; import { enableTypeCoercion } from './coercion'; @@ -37,7 +38,7 @@ export function parse( async?: false; errorMap?: ZodErrorMap; }, -): Submission>; +): Submission, output>; export function parse( payload: FormData | URLSearchParams, options: { @@ -45,7 +46,7 @@ export function parse( async: true; errorMap?: ZodErrorMap; }, -): Promise>>; +): Promise, output>>; export function parse( payload: FormData | URLSearchParams, options: { @@ -53,7 +54,9 @@ export function parse( async?: boolean; errorMap?: ZodErrorMap; }, -): Submission> | Promise>> { +): + | Submission, output> + | Promise, output>> { return baseParse(payload, { resolve(payload, intent) { const errorMap = options.errorMap;