teslamotors / informed

A lightweight framework and utility for building powerful forms in React applications
https://teslamotors.github.io/informed
MIT License
956 stars 173 forks source link

feat: allow add types when we use FormState type #475

Open mau2099 opened 1 week ago

mau2099 commented 1 week ago

so that way, we can do:

  const handleOnSubmit = async ({ values }: FormState<AttendanceDetailsForm>) => {
   ...
  }

but we can still use former way, so no breaking changes

  const handleOnSubmit = async ({ values }: FormState) => {
   ...
  }

*Note: changes based on this chart https://teslamotors.github.io/informed/api-reference/fieldState

mau2099 commented 1 week ago

maintainer is requiring at least 3 thumbs up here from senior typescript devs, so if you are seeing this, drop your thoughts!

raff-wakflo commented 3 days ago

I believe this is great for having strictly typed form schema.