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
At the moment, it is difficult to tell whether a variable that you are returning is reactive or not, as when you hover over the variable, it just shows the primitive value such as boolean. In Svelte 4, it didn't really matter because everything was reactive, but now, it needs to be more explicit (from my understanding).
Describe the proposed solution
It would be nice if when hovering over a state enabled variable that Typescript could point this out, such as SvelteState<string>.
Importance
would make my life easier
The text was updated successfully, but these errors were encountered:
I doubt this is practical. We'd also need to worry about how the types of SvelteState<some_type> interact with everything else. I don't know that we can tell TypeScript 'SvelteState<some_type> behaves basically like some_type, but don't just drop the SvelteState<> part.
A boolean returned from a function will never be reactive since it's a primitive which is passed by value.
Encoding this in the types will not work anyway, though, since that is a separate thing. If you assign a state variable to a new constant, the type would transfer but the reactivity would be lost for primitives.
Describe the problem
At the moment, it is difficult to tell whether a variable that you are returning is reactive or not, as when you hover over the variable, it just shows the primitive value such as
boolean
. In Svelte 4, it didn't really matter because everything was reactive, but now, it needs to be more explicit (from my understanding).Describe the proposed solution
It would be nice if when hovering over a
state
enabled variable that Typescript could point this out, such asSvelteState<string>
.Importance
would make my life easier
The text was updated successfully, but these errors were encountered: