🎉 feature: new type FieldPathByValue field path by value generic implementation
function CustomFormComponent<
TFieldValues extends FieldValues,
Path extends FieldPathByValue<TFieldValues, Date>
>({ control, name }: { control: Control<FieldValues>; name: Path }) {
const { field } = useController({
control,
name,
});
}
function App() {
const { control } = useForm<{
foo: Date;
baz: string;
}>();
return (
<form>
<CustomFormComponent control={control} name="foo" /> {/* no error */}
<CustomFormComponent control={control} name="baz" /> {/* throw an error since baz is string */}
</form>
);
}
🛵 close #8969 improve type for useFieldArray rules validate prop #8974

🛗 upgrade to TS 4.8.0 and Jest 29 #8620
🐞 fix #8970 register field array cause render issue #8972
🐞 fix: typings for useWatch() with no arguments #8923
🐞 fix #8919 make useController fieldState properties enumerable
const { fieldState } = useController({ name: 'test' })
const copy = {...fieldState} ✅
👶🏻 close #8909 form context children prop type (https://github.com/react-hook-form/react-hook-form/pull/8910)
<FormProvider {...methods}>
<div /> // ✅
<div /> // ✅
</FormProvider>
🐌 allow field errors to escape type check when provided with any type 🔐 github workflows security hardening #8965 💚 ci: stop csb ci from publishing a comment on PR (https://github.com/react-hook-form/react-hook-form/pull/8977)