-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Add setter to let variables accessors #11983
Comments
Exporting a (There also is a compiler option |
You still can export function-setters export const setMyProp = (v) => { myProp = v; }; or an object with all [writable] props export const options1 = someStateObject;
export const options2 = {
get myProp() { return myProp; },
set myProp(v) { myProp = v; },
}; |
This was a deliberate choice though I can't exactly remember the rationale. Adding the 5.0 milestone so that we reach a final decision on this before the semver window closes |
This was originally requested in #10310 (the readonly version) and then implemented in #10523 but without any real rationale for one way or the other. The only one I could imagine is "it makes the difference between I would be ok with adjusting that so that |
Describe the problem
In Svelte 3/4 the export keyword created accessors for const variables and functions and created props for let variables and when using the accessors option the keyword also created accessors for let variables
In Svelte 5, the export keyword only creates accessors, but unlike v4 accessors, v5 accessors only have read capacity, creating a feature disparity between versions
Describe the proposed solution
Add setters to accessors of variables declared using let exported from a component
Importance
would make my life easier
The text was updated successfully, but these errors were encountered: