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
Found this issue while working on #15673. Basically, if you have a function (or other thing that adds a new this binding without being a class) inside of a class method, Svelte will still wrap any private property access with $.get/$.set.
I feel like accessing private properties inside this scopes that aren't classes should probably be a syntax error, but if not, at least this should be fixed. I put in a check for this in the code for $state.invalidate, so it shouldn't be too hard to fix for everything else.
The text was updated successfully, but these errors were encountered:
Ocean-OS
changed the title
Svelte ignores new this bindings in classes that use private class fields declared with $state
Svelte ignores new this bindings regarding private class fields declared with $stateApr 4, 2025
Describe the bug
Found this issue while working on #15673. Basically, if you have a function (or other thing that adds a new
this
binding without being a class) inside of a class method, Svelte will still wrap any private property access with$.get
/$.set
.I feel like accessing private properties inside
this
scopes that aren't classes should probably be a syntax error, but if not, at least this should be fixed. I put in a check for this in the code for$state.invalidate
, so it shouldn't be too hard to fix for everything else.Reproduction
REPL link
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: