chore: fix docs ()

pull/14543/head
Rich Harris 5 months ago committed by GitHub
parent 3d9122fcc4
commit 4c4f18b24c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -26,6 +26,8 @@ Given a case like this...
You can fix this by separating it into two statements:
```js
let object = { array: [0] };
// ---cut---
function add() {
object.array ??= [];
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
Often, the result is the same — for example these can be considered equivalent:
```js
let a = 1, b = 2, sum = 3;
// ---cut---
$: sum = a + b;
```
```js
let a = 1, b = 2;
// ---cut---
const sum = $derived(a + b);
```
In some cases — such as the one that triggered the above warning — they are _not_ the same:
```js
let a = 1, b = 2, sum = 3;
// ---cut---
const add = () => a + b;
// the compiler can't 'see' that `sum` depends on `a` and `b`, but

@ -22,6 +22,8 @@ Given a case like this...
You can fix this by separating it into two statements:
```js
let object = { array: [0] };
// ---cut---
function add() {
object.array ??= [];
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
Often, the result is the same — for example these can be considered equivalent:
```js
let a = 1, b = 2, sum = 3;
// ---cut---
$: sum = a + b;
```
```js
let a = 1, b = 2;
// ---cut---
const sum = $derived(a + b);
```
In some cases — such as the one that triggered the above warning — they are _not_ the same:
```js
let a = 1, b = 2, sum = 3;
// ---cut---
const add = () => a + b;
// the compiler can't 'see' that `sum` depends on `a` and `b`, but

Loading…
Cancel
Save