-
-
Couldn't load subscription status.
- Fork 4.7k
Closed
Labels
Description
Describe the bug
The compiler extracts functions to the top level scope and adds dependencies as arguments at the end.
This does not work if the function has spread arguments.
(Found by jakub on Discord.)
Reproduction
<script>
let count = $state(0);
function increment(...args) {
count += 1
}
</script>
<button on:click={increment}>
clicks: {count}
</button>Comma is not permitted after the rest element (6:26)
Generated JS:
function increment(...args, count) {
$.set(count, $.get(count) + 1);
}Logs
No response
System Info
REPLSeverity
annoyance
ricvelozo