noahsalvi / svelte-use-form

The most compact reactive form controller (including Validation) that you'll ever see.
MIT License
252 stars 14 forks source link

Use keys of form object #24

Closed enyo closed 2 years ago

enyo commented 3 years ago

I'm quite new to TS but I think that it should be possible to use the keys of the FormProperties that is passed when initializing with const form = useForm({ username: { initial: "foo" } }); so that when accessing $form.values it knows that the only valid key is username.

If that is not possible, it would be great to at least provide some sort of generic argument to useForm so accessing an invalid key is not possible.

noahsalvi commented 3 years ago

Absolutely, I'll look into it