-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Allow creating read-only accessors of primitive states #10310
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
Comments
The comparison isn't fully correct. In Svelte 4, Can you give an example what exactly is no longer achievable in Svelte 5? What's the use case behind this? |
It is not an existing feature in V4 |
It would be confusing to explain why you can export |
Ok, I understand better what the intention is It seems strange to me to keep the same restrictions inside and outside a component, even if the export keyword being used is the same it is doing different things But if what is being sought is syntax parity with modules then it should be possible to use |
In Svelte 7 that will probably be allowed but until then |
note that we reverted this change in #10523, this will now work |
Uh oh!
There was an error while loading. Please reload this page.
Describe the problem
In Svelte 3/4 the export keyword had two different meanings within components, create props and create accessors
In Svelte 5 the keyword has only 1 meaning, creating read-only accessors, and if you want to add the ability to write to the accessor the value also needs to be declared as a prop
However, it is not possible to create let variable accessors this way
only this way
And it is also not possible to create state accessors for let variables that are reassigned without also declaring it as a prop
Describe the proposed solution
Allow the use of
export let
in runes mode for the purpose of creating read-only accessors and allow the creation of read-only accessors for primitive statesImportance
would make my life easier
The text was updated successfully, but these errors were encountered: