Skip to content

docs: correct setError error argument type signature#1205

Merged
bluebill1049 merged 2 commits intoreact-hook-form:masterfrom
dfedoryshchev:docs/fix-seterror-erroroption-type
Apr 25, 2026
Merged

docs: correct setError error argument type signature#1205
bluebill1049 merged 2 commits intoreact-hook-form:masterfrom
dfedoryshchev:docs/fix-seterror-erroroption-type

Conversation

@dfedoryshchev
Copy link
Copy Markdown
Contributor

The setError docs describe the second argument as FieldError with type and types marked as required. Both are wrong against the library source.

The argument type is ErrorOption, not FieldError (see UseFormSetError in src/types/form.ts:644). All three fields on ErrorOption are optional (src/types/errors.ts:21-25):

export type ErrorOption = {
  message?: Message;
  type?: LiteralUnion<keyof RegisterOptions, string>;
  types?: MultipleFieldErrors;
};

FieldError is a different type (the shape of entries on formState.errors), so the current wording also pointed at the wrong thing.

Two content changes in src/content/docs/useform/seterror.mdx: the signature line (error: FieldError to error: ErrorOption) and the error props row (optional markers on type and types). Prettier reflowed the table column widths; split into a second commit matching the repo's format-as-follow-up pattern.

Addresses point 1 from #1065. The other points (types usage details, "Multiple Errors" naming, nested-merge behavior) need separate verification and are out of scope here.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 24, 2026

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

A member of the Team first needs to authorize it.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 24, 2026

Deploy Preview for sage-cassata-31d224 ready!

Name Link
🔨 Latest commit e95e065
🔍 Latest deploy log https://app.netlify.com/projects/sage-cassata-31d224/deploys/69ebc70ae48aa50007510a23
😎 Deploy Preview https://deploy-preview-1205--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.

@bluebill1049 bluebill1049 merged commit 4c50a5b into react-hook-form:master Apr 25, 2026
7 of 8 checks passed
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.

2 participants