mirror of https://github.com/sveltejs/svelte
fix: improve ssr code generation for class property $derived (#10661)
* fix: improve ssr code generation for class property $derived * fix tspull/10664/head
parent
99e1665ce1
commit
b2e9be2148
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: improve ssr code generation for class property $derived
|
@ -0,0 +1,5 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `2`
|
||||||
|
});
|
@ -0,0 +1,15 @@
|
|||||||
|
<script>
|
||||||
|
export class Counter {
|
||||||
|
count = $state(0);
|
||||||
|
doubled = $derived(this.count * 2);
|
||||||
|
|
||||||
|
constructor(initialCount = 0) {
|
||||||
|
this.count = initialCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const counter = new Counter(1);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{counter.doubled}
|
||||||
|
|
Loading…
Reference in new issue