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
I like to declare states using "var", because they become more noticeable when reading the code. But using this syntax in .svelte.ts files, sometimes the states are "true" when I'm sure they're false. When I output them using console.log, I was very surprised - instead of false, I got the object of the state itself. It definitely wasn't meant to be that way.
- fixes#12807: state declared with var is now retrieved using a new `safe_get` function, which works like `get` but checks for undefined
- fixes#12900: ensure we're not creating another new scope for block statements of function declarations, which resulted in var declarations getting "swallowed" (because they were hoisted to the function declaration scope and never seen by our logic)
Describe the bug
I like to declare states using "var", because they become more noticeable when reading the code. But using this syntax in .svelte.ts files, sometimes the states are "true" when I'm sure they're false. When I output them using console.log, I was very surprised - instead of false, I got the object of the state itself. It definitely wasn't meant to be that way.
Reproduction
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACmVSy07EMAz8FSvi0IpVF67d7Up8ACeOFKHSdSFLmlSJuwJV-Xfy6mOFeqhsz9iecSbWcYGGla8Tk02PrGRPw8B2jH4HH5grCkIXGzXq1meOptV8oFMta-L9oDTBBEo-q1GShU6rHupEq5kH3QAJDb2Q0ggLttiHRBE5xcXU7DDzBBK0vjNUcGeoIcwecl91tW6ULXElgctWY4-SshymwKTIua_gMbSykZG2zByuOq1QaZTAQqjPbNmu-ETXLY_kvJbH_apaHj9Gcr2c6Fbw9rualgVscCVkTQlT2MJ6dmScnI-9OvOO45mVpEe0u8X2rQmr_xez9X6RbJyhAgMl45ITb0TSfm00vF8bMeJq2YxIxmmkUctZv1dqZDOYL-Vd7hphcPHRXa6DpZxDosa-xZzP4sBol_8SLKZT1u7i3_h5nr4ZsiwcCjcE66JwPvxJT2ijHexhU_KXpM0Lq25sisIc_v8R3uwf-J-cIQcDAAA=
See dev-console
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: