Skip to content

Commit 4c4f18b

Browse files
authored
chore: fix docs (#14538)
1 parent 3d9122f commit 4c4f18b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

documentation/docs/98-reference/.generated/client-warnings.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Given a case like this...
2626
You can fix this by separating it into two statements:
2727

2828
```js
29+
let object = { array: [0] };
30+
// ---cut---
2931
function add() {
3032
object.array ??= [];
3133
object.array.push(object.array.length);
@@ -131,16 +133,22 @@ In runes mode, effects and deriveds re-run when there are changes to the values
131133
Often, the result is the same — for example these can be considered equivalent:
132134

133135
```js
136+
let a = 1, b = 2, sum = 3;
137+
// ---cut---
134138
$: sum = a + b;
135139
```
136140

137141
```js
142+
let a = 1, b = 2;
143+
// ---cut---
138144
const sum = $derived(a + b);
139145
```
140146

141147
In some cases — such as the one that triggered the above warning — they are _not_ the same:
142148

143149
```js
150+
let a = 1, b = 2, sum = 3;
151+
// ---cut---
144152
const add = () => a + b;
145153

146154
// the compiler can't 'see' that `sum` depends on `a` and `b`, but

packages/svelte/messages/client-warnings/warnings.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Given a case like this...
2222
You can fix this by separating it into two statements:
2323

2424
```js
25+
let object = { array: [0] };
26+
// ---cut---
2527
function add() {
2628
object.array ??= [];
2729
object.array.push(object.array.length);
@@ -95,16 +97,22 @@ In runes mode, effects and deriveds re-run when there are changes to the values
9597
Often, the result is the same — for example these can be considered equivalent:
9698
9799
```js
100+
let a = 1, b = 2, sum = 3;
101+
// ---cut---
98102
$: sum = a + b;
99103
```
100104
101105
```js
106+
let a = 1, b = 2;
107+
// ---cut---
102108
const sum = $derived(a + b);
103109
```
104110
105111
In some cases — such as the one that triggered the above warning — they are _not_ the same:
106112
107113
```js
114+
let a = 1, b = 2, sum = 3;
115+
// ---cut---
108116
const add = () => a + b;
109117

110118
// the compiler can't 'see' that `sum` depends on `a` and `b`, but

0 commit comments

Comments
 (0)