Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte ignores new this bindings regarding private class fields declared with $state #15682

Open
Ocean-OS opened this issue Apr 4, 2025 · 0 comments

Comments

@Ocean-OS
Copy link
Contributor

Ocean-OS commented Apr 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

N/A

Severity

annoyance

@Ocean-OS 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 $state Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant