Closed
Description
Describe the bug
declare
gets removed from class properties in TypeScript script-tags.
This causes values set from parents to get removed. Ex. if you want to set a value via Object.assign(...)
Reproduction
<script module lang='ts'>
class Parent {
constructor() {
this.value = 'Where am I?'
}
}
class Child extends Parent {
declare value: string
}
</script>
<script>
const parent = new Parent()
const child = new Child()
</script>
<table>
<tbody>
<tr><td>Parent</td><td>{parent.value}</td><td>{typeof parent.value}</td></tr>
<tr><td>Child</td><td>{child.value}</td><td>{typeof child.value}</td></tr>
</tbody>
</table>
Logs
System Info
System:
OS: Windows 11 10.0.22631
CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Memory: 6.49 GB / 31.93 GB
Binaries:
Node: 23.11.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
bun: 1.2.16 - ~\.bun\bin\bun.EXE
Browsers:
Edge: Chromium (132.0.2957.115)
npmPackages:
svelte: ^5.34.1 => 5.34.1
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels