Skip to content

Commit 17ba400

Browse files
authored
fix: compile error for incorrectly place $state.link or wrong argument count (#12954)
1 parent 0b51ff0 commit 17ba400

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export function CallExpression(node, context) {
7474

7575
case '$state':
7676
case '$state.raw':
77+
case '$state.link':
7778
case '$derived':
7879
case '$derived.by':
7980
if (
@@ -85,7 +86,7 @@ export function CallExpression(node, context) {
8586

8687
if ((rune === '$derived' || rune === '$derived.by') && node.arguments.length !== 1) {
8788
e.rune_invalid_arguments_length(node, rune, 'exactly one argument');
88-
} else if (rune === '$state' && node.arguments.length > 1) {
89+
} else if ((rune === '$state' || rune === '$state.link') && node.arguments.length > 1) {
8990
e.rune_invalid_arguments_length(node, rune, 'zero or one arguments');
9091
}
9192

0 commit comments

Comments
 (0)