✨ Features
-
Add
shouldTouchoption totrigger()([#13671](https://github.com/react-hook-form/react-hook-form/pull/13671))setValuealready supportedshouldTouch;trigger()now does too. This allows you to mark field(s) as touched after manual or programmatic validation, such as validate-on-mount or multi-step form navigation, without needing asetValueworkaround:// Mark a single field as touched after validating it await trigger('firstName', { shouldTouch: true }); // Mark every mounted field as touched after validating the whole form await trigger(undefined, { shouldTouch: true }); -
Add
OpaqueTypesregistry for opaque leaf types ([#13676](https://github.com/react-hook-form/react-hook-form/pull/13676))Recursive type helpers (
Path,DeepPartial,DeepRequired,FieldErrorsImpl, etc.) previously stopped only atPrimitive | BrowserNativeObject. As a result, rich third-party value types such asDayjsandDecimalcould be recursively traversed member-by-member, potentially causing TypeScript to report "Excessive complexity" diagnostics on large form types.You can now register a type as an opaque leaf via declaration merging:
import type { Dayjs } from 'dayjs'; declare module 'react-hook-form' { interface OpaqueTypes { dayjs: Dayjs; } }While the registry is empty, types remain identical to the existing behavior. This is purely opt-in.
🐞 Fixes
- Fix inconsistent behavior among
useController().field.onChange()-like APIs. ([#13673](https://github.com/react-hook-form/react-hook-form/pull/13673)) - Fix
Controllerunder a null parent submittingundefinedinstead of a value. ([]())