-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Closed
Copy link
Description
Version Number
7.66.1
Codesandbox/Expo snack
Steps to reproduce
- Define a Branded Type by intersecting a primitive (e.g., string) with a brand object.
- Use this type in a FormValues interface.
- Pass a value of an incorrect primitive type (e.g., number) to defaultValues for that field.
- Observe the TypeScript error message. Instead of a simple "type mismatch" between string and number, the error indicates that the value is being compared against the internal brand structure (an object), showing that react-hook-form has incorrectly expanded the Branded Type.
Expected behaviour
When a type is an intersection of a primitive and a brand (e.g., string & { ... }), it should not be expanded into an object structure. The expected behavior is that defaultValues should validate the value against the BrandedType itself, maintaining the type's integrity as a single field value rather than a nested form object.
What browsers are you seeing the problem on?
No response
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels