mirror of https://github.com/sveltejs/svelte
fix: prevent state runes from being called with spread (#15585)
* fix: prevent state runes from being called with spread * prevent spread arguments for all runes except $inspect --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/15587/head
parent
7fe9bf524b
commit
3080c1334e
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: prevent state runes from being called with spread
|
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"code": "rune_invalid_spread",
|
||||
"end": {
|
||||
"column": 35,
|
||||
"line": 3
|
||||
},
|
||||
"message": "`$derived.by` cannot be called with a spread argument",
|
||||
"start": {
|
||||
"column": 15,
|
||||
"line": 3
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,4 @@
|
||||
<script>
|
||||
const args = [0];
|
||||
const count = $derived.by(...args);
|
||||
</script>
|
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"code": "rune_invalid_spread",
|
||||
"end": {
|
||||
"column": 32,
|
||||
"line": 3
|
||||
},
|
||||
"message": "`$derived` cannot be called with a spread argument",
|
||||
"start": {
|
||||
"column": 15,
|
||||
"line": 3
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,4 @@
|
||||
<script>
|
||||
const args = [0];
|
||||
const count = $derived(...args);
|
||||
</script>
|
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"code": "rune_invalid_spread",
|
||||
"end": {
|
||||
"column": 34,
|
||||
"line": 3
|
||||
},
|
||||
"message": "`$state.raw` cannot be called with a spread argument",
|
||||
"start": {
|
||||
"column": 15,
|
||||
"line": 3
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,4 @@
|
||||
<script>
|
||||
const args = [0];
|
||||
const count = $state.raw(...args);
|
||||
</script>
|
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"code": "rune_invalid_spread",
|
||||
"end": {
|
||||
"column": 30,
|
||||
"line": 3
|
||||
},
|
||||
"message": "`$state` cannot be called with a spread argument",
|
||||
"start": {
|
||||
"column": 15,
|
||||
"line": 3
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,4 @@
|
||||
<script>
|
||||
const args = [0];
|
||||
const count = $state(...args);
|
||||
</script>
|
Loading…
Reference in new issue