mirror of https://github.com/sveltejs/svelte
fix: disallow $state/$derived in const tags (#15115)
parent
94d80c6e2c
commit
0e0f01ee1c
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: disallow $state/$derived in const tags
|
@ -0,0 +1,14 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "state_invalid_placement",
|
||||||
|
"message": "`$derived(...)` can only be used as a variable declaration initializer or a class field",
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 15
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 26
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,3 @@
|
|||||||
|
{#snippet test()}
|
||||||
|
{@const der = $derived(0)}
|
||||||
|
{/snippet}
|
Loading…
Reference in new issue