You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
(Moved in Svelte repo)
Hello everyone,
While upgrading my components to use the new Generics syntax (Svelte Docs), I ran into an issue:
I have two components:
However, I am currently getting a type unknown for my onchange parameter.
It looks like the type is not correctly infered because of the usage of the setContext/getContext.
Here’s how I’m using these components:
Is there a way to specify the expected type in Svelte, ensuring that the onchange event correctly infers the type of the selected item?
Something like
<MyComponent<string>>
or another generic-friendly syntax that I may not be aware of?Any guidance would be greatly appreciated!
Here’s a reproducible sandbox:
https://codesandbox.io/p/github/Kayoshi-dev/sample/main
Beta Was this translation helpful? Give feedback.
All reactions