diff --git a/documentation/docs/98-reference/.generated/compile-errors.md b/documentation/docs/98-reference/.generated/compile-errors.md index 0d25173711..02e762dc48 100644 --- a/documentation/docs/98-reference/.generated/compile-errors.md +++ b/documentation/docs/98-reference/.generated/compile-errors.md @@ -821,6 +821,18 @@ Cannot use `%rune%` rune in non-runes mode Cannot use rune without parentheses ``` +Runes are keywords rather than values — they can't be assigned to a variable or passed to a function, only called. Referencing one without parentheses is therefore an error... + +```js +let count = $state; +``` + +...whether it's a rune like `$state` or one reached through a property, like `$derived.by`. Add the parentheses, along with any arguments the rune expects: + +```js +let count = $state(0); +``` + ### rune_removed ``` diff --git a/packages/svelte/messages/compile-errors/script.md b/packages/svelte/messages/compile-errors/script.md index 743fe31fde..9980db4c19 100644 --- a/packages/svelte/messages/compile-errors/script.md +++ b/packages/svelte/messages/compile-errors/script.md @@ -186,6 +186,18 @@ This turned out to be buggy and unpredictable, particularly when working with de > Cannot use rune without parentheses +Runes are keywords rather than values — they can't be assigned to a variable or passed to a function, only called. Referencing one without parentheses is therefore an error... + +```js +let count = $state; +``` + +...whether it's a rune like `$state` or one reached through a property, like `$derived.by`. Add the parentheses, along with any arguments the rune expects: + +```js +let count = $state(0); +``` + ## rune_removed > The `%name%` rune has been removed