Description
Describe the bug
Declaring and assigning to a non-derived private field in a class that has a public derived field with the same name breaks with a Cannot assign to derived state
compile error, this seems to be broken by #15228.
<script>
class X {
#deps = () => [];
deps = $derived.by(() => {
return [];
});
constructor(f = () => []) {
this.#deps = f;
}
}
</script>
This was working/compiling correctly in 5.19.9
Reproduction
Logs
Cannot assign to derived state
https://svelte.dev/e/constant_assignment
System Info
System:
OS: Linux 6.12 Fedora Linux Asahi Remix 41 (Forty One)
CPU: (8) arm64 unknown
Memory: 15.83 GB / 31.12 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 18.20.4 - ~/.n/bin/node
Yarn: 1.22.21 - ~/.n/bin/yarn
npm: 10.7.0 - ~/.n/bin/npm
pnpm: 10.2.1 - ~/.local/share/pnpm/pnpm
bun: 1.2.2 - ~/.n/bin/bun
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels