ciscoheat / sveltekit-superforms

Making SvelteKit forms a pleasure to use!
https://superforms.rocks
MIT License
2.26k stars 67 forks source link

`FormPathArrays` always `never` #464

Closed hmnd closed 3 months ago

hmnd commented 3 months ago

Description FormPathArrays doesn't seem to work at the moment. It always returns a type of never, preventing me from setting a field attribute based on the form type.

If applicable, a MRE https://www.sveltelab.dev/tpcacwor358foi4?files=.%2Fsrc%2Flib%2FCheckboxGroup.svelte%2C.%2Fsrc%2Froutes%2F%2Bpage.svelte%2C.%2Fsrc%2Froutes%2Fschema.ts

hmnd commented 3 months ago

It appears this is more of a documentation issue.

From what I can tell, FormPathArrays expects an array as the provided type, so instead of FormPathArrays<T, TItem>, it needs to be FormPathArrays<T, Array<TItem>>. Perhaps that should be made more clear or maybe the input type could be narrowed to extend Array.