Skip to content

docs(FormState): type useForm in example so errors.foo.message compiles - #1246

Closed
MidnightLabDev wants to merge 1 commit into
react-hook-form:masterfrom
MidnightLabDev:docs/type-formstate-example
Closed

MidnightLabDev wants to merge 1 commit into
react-hook-form:masterfrom
MidnightLabDev:docs/type-formstate-example

Conversation

@MidnightLabDev

Copy link
Copy Markdown

The FormState example on the useFormState / formState page calls useForm() without a type, then reads errors.foo?.message. With TypeScript strict, that fails (TS2322: foo doesn't exist on the field errors of an untyped form), so the example doesn't compile when copied.

This adds a FormValues type and uses useForm<FormValues>(). I checked the fixed snippet against react-hook-form master with tsc --strict: zero errors (the original gives TS2322 at errors.foo?.message). Prettier check on formstate.mdx passes.

AI assistance was used to find and check this; I've reviewed the change.

@vercel

vercel Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@MidnightLabDev is attempting to deploy a commit to the BEEKAI OSS Team on Vercel.

A member of the Team first needs to authorize it.

@netlify

netlify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for sage-cassata-31d224 ready!

Name Link
🔨 Latest commit 1e9550c
🔍 Latest deploy log https://app.netlify.com/projects/sage-cassata-31d224/deploys/6ae998eb30ac023ec0fbc5ea
😎 Deploy Preview https://deploy-preview-1246--sage-cassata-31d224.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@MidnightLabDev
MidnightLabDev marked this pull request as ready for review November 3, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant