Skip to content

fix(AuthForm): type submit payload with the schema output - #6816

Open
lazerg wants to merge 1 commit into
nuxt:v4from
lazerg:fix/issue-6814-form-onsubmit-type
Open

fix(AuthForm): type submit payload with the schema output#6816
lazerg wants to merge 1 commit into
nuxt:v4from
lazerg:fix/issue-6814-form-onsubmit-type

Conversation

@lazerg

@lazerg lazerg commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves #6814

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

AuthForm types its submit emit from the local state, which follows the schema input, while the onSubmit prop it forwards to Form follows the schema output. A field like rememberMe: z.boolean().default(false) makes those differ (optional going in, required coming out), and the two signatures get intersected in the template, so a handler typed with the output is rejected:

Type '(payload: FormSubmitEvent<{ email: string; rememberMe: boolean; }>) => Promise<void>' is not assignable to type '(((() => void) | ((event: FormSubmitEvent<{ email: string; rememberMe: boolean; }>) => void)) & ((payload: FormSubmitEvent<{ email: string; rememberMe?: boolean | undefined; }>) => any)) | undefined'.
  ...
      Target signature provides too few arguments. Expected 1 or more, but got 0.

What the form submits is the transformed data, so the output is the right type here. Typing the emit with FormData<T> lines it up with the prop and the error goes away. Schemas without defaults or transforms are unaffected, their input and output are identical.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@lazerg
lazerg requested a review from benjamincanac as a code owner August 8, 2026 08:05
@github-actions github-actions Bot added the v4 #4488 label Aug 8, 2026
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3c459a65-b654-4381-b705-7aabd4457818

📥 Commits

Reviewing files that changed from the base of the PR and between 735ce1b and 4f30bcd.

📒 Files selected for processing (1)
  • test/components/AuthForm.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/components/AuthForm.spec.ts

📝 Walkthrough

Walkthrough

AuthForm.vue now types emitted submit events with FormData<T> instead of the local reactive state type. The test suite adds a compile-time assertion that a schema with a defaulted rememberMe field produces a submit payload with rememberMe: boolean.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main fix: typing the AuthForm submit payload with the schema output.
Description check ✅ Passed The description explains the AuthForm type mismatch, the affected schema outputs, and the linked issue.
Linked Issues check ✅ Passed The changes align AuthForm submit emits with FormData, resolving issue #6814 for schemas with defaults or transformations.
Out of Scope Changes check ✅ Passed The changes are limited to the AuthForm emit type and a focused compile-time test for the reported type error.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

test/components/AuthForm.spec.ts

Parsing error: Unexpected token {


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codspeed-hq

codspeed-hq Bot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing lazerg:fix/issue-6814-form-onsubmit-type (4f30bcd) with v4 (6add5fb)

Open in CodSpeed

@pkg-pr-new

pkg-pr-new Bot commented Aug 8, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/ui@6816

commit: 4f30bcd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typecheck failed: @submit of <AuthForm> <Form> , Target signature provides too few arguments

1 participant