diff --git a/documentation/docs/98-reference/.generated/client-warnings.md b/documentation/docs/98-reference/.generated/client-warnings.md index 60eb3e126c42..ef19a28994bd 100644 --- a/documentation/docs/98-reference/.generated/client-warnings.md +++ b/documentation/docs/98-reference/.generated/client-warnings.md @@ -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 diff --git a/packages/svelte/messages/client-warnings/warnings.md b/packages/svelte/messages/client-warnings/warnings.md index 482a3d7faad3..019e83e7b120 100644 --- a/packages/svelte/messages/client-warnings/warnings.md +++ b/packages/svelte/messages/client-warnings/warnings.md @@ -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