Closed as not planned
Description
Describe the bug
When trying to bind:
to a MemberExpression (e.g bind:checked={checked(true).current}
) Svelte throws the error:
Can only bind to an Identifier or MemberExpression
Here's a simple snippet highlighting the issue:
<script>
const state = $state({
checked: true,
});
const store = Object.fromEntries(
Object.keys(state).map(key => [
key,
(current = false) => {
return current
? {
get current() {
return state[key];
},
set current(value) {
state[key] = value;
},
}
: state[key];
},
])
);
</script>
<!-- This causes the error ❌ -->
<input type="checkbox" bind:checked={store.checked(true).current} />
Reproduction
Here's a REPL
Logs
No response
System Info
Playground version 5.2.2
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels