-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for
$derived.by
type (#479)
- Loading branch information
Showing
10 changed files
with
11,027 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"svelte-eslint-parser": minor | ||
--- | ||
|
||
feat: add support for `$derived.by` type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tests/fixtures/parser/ast/svelte5/docs/runes/02-2-$derived-by-input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script> | ||
let numbers = $state([1, 2, 3]); | ||
let total = $derived.by(() => { | ||
let total = 0; | ||
for (const n of numbers) { | ||
total += n; | ||
} | ||
return total; | ||
}); | ||
</script> | ||
|
||
<button on:click={() => numbers.push(numbers.length + 1)}> | ||
{numbers.join(' + ')} = {total} | ||
</button> |
Oops, something went wrong.