Use generics for types where possible #1188
Labels
enhancement
New feature or request
feature request
Request a feature or introduce and update to the project.
Describe what feature you'd like. Pseudo-code, mockups, or screenshots of similar solutions are encouraged!
Initially thought of this for the
Autocomplete
component, but after discussion on Discord, it seems this may be a more sweeping change.Svelte has support for generic types. We can constrain them similar to
<T extends S>
in a generic:Now if we had a list of items of type
B = { value: string; foo: Bar }
, and the user setsbind:selected
on the parent, the type ofselected
would beB
, instead of just{value: string}
What type of pull request would this be?
Enhancement
Any links to similar examples or other references we should review?
No response
The text was updated successfully, but these errors were encountered: