zod

const inputSchema = z.object({
  aaa: z.number(),
  bbb: z.string(),
});

type InputSchema = z.infer<typeof inputSchema>;

type Props = {};

export default function RandomStringForm({}: Props) {
  const { register, handleSubmit, watch } = useForm<InputSchema>({
    resolver: zodResolver(inputSchema as any), // <- bug after zod 3.22
  });
  const watchValue = watch();

  const onSubmit: SubmitHandler<InputSchema> = (data) => {
    console.log(data);
  };