resolvers icon indicating copy to clipboard operation
resolvers copied to clipboard

feat infer form type from zod schema and fix test

Open kagurazaka-0 opened this issue 3 years ago • 0 comments

  • feat infer FormType from zod schema without using type assertion
const HogeSchema = z.object({
  name: z.string(),
  age: z.number(),
});

const _ = useForm({ resolver: zodResolver(HogeSchema) });
// _ is UseFormReturn<{ name: string; age: number }>

_.watch("age") // work! it is number 
_.watch("name") // work! it is string
  • fix type error in test

I referred to #417, thanks @maddijoyce !

kagurazaka-0 avatar Aug 28 '22 17:08 kagurazaka-0