react-hook-form 方法有哪些类型?

What are the types of react-hook-form methods?

我正在使用 react-hook-form,我想在额外的组件中包含表单的某些部分。因此,我需要传递一些方法。正确的 typescript types 方法是什么:register, control, setValue, watch ?

Example Sandbox

interface INameInput {
  register: any;
  setValue: any;
  watch: any;
  control: any;
}

const NameInput: React.FC<INameInput> = (props: INameInput) => {
  const { register, control, setValue, watch } = props;

  return (
    <>
        <label>First Name</label>
        <input name="firstName" ref={register} />

        <label>Last Name</label>
        <input name="lastName" ref={register} />
    </>
  );
};

export default function App() {
  const { register, control, setValue, watch} = useForm<FormValues>();

  return (
      <form >
        <NameInput 
           register={register} 
           control={control} 
           setValue={setValue} 
           watch={watch} 
        />
      </form>
  );
}

这是包含导出类型列表的页面

https://react-hook-form.com/ts

我想你是追求以下类型

https://react-hook-form.com/ts#UseFormMethods

例如:

UseFormMethods['register']