Open fzembow opened 1 month ago
I can't see any LoginForm.svelte in the example link?
@ciscoheat I'm sorry - I guess sveltelab didn't save my changes earlier :(
Here is a corrected repro link: https://www.sveltelab.dev/fh9ym08604bfrxv
If you click into LoginForm.svelte now, the issue will appear
Again, this might be a limitation of Typescript (or my knowledge thereof) but I am very thankful that you would take a look -- to me, extending the componentization even further was the natural thing to do.
I see now, I should have looked closer at the code example. You need const
, otherwise it will treat each value as string
and that will probably mess up the typing. The types behind the scenes are quite complicated, especially with generics.
I did manage to remove the error once locally, so try updating to latest typescript (and maybe latest svelte 5) and maybe it will work.
Description
I'm trying to even further componentize the approach in the componentization guide, by allowing users to pass an array of the FormPathLeaves to render the form fields.
However, I'm seeing a TS error, "Type instantiation is excessively deep and possibly infinite" when trying to use FormPathLeaves as a variable, rather than hardcoding it. You can see three parallel approaches in the below snippet.
This may very well be some limitation of my typescript knowledge... but is this just not intrinsically possible? Should I be listing out the paths with a different type annotation?
If applicable, a MRE
See this example, which has the error on Sveltelab when you view the LoginForm.svelte file: EXAMPLE