diff --git a/.changeset/neat-dingos-clap.md b/.changeset/neat-dingos-clap.md new file mode 100644 index 0000000000..6954c6cd40 --- /dev/null +++ b/.changeset/neat-dingos-clap.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: tweak invalid dollar prefix rules around function args diff --git a/packages/svelte/src/compiler/phases/scope.js b/packages/svelte/src/compiler/phases/scope.js index 02cd980adc..1a65ed26fc 100644 --- a/packages/svelte/src/compiler/phases/scope.js +++ b/packages/svelte/src/compiler/phases/scope.js @@ -73,7 +73,13 @@ export class Scope { error(node, 'invalid-dollar-binding'); } - if (node.name.startsWith('$') && declaration_kind !== 'synthetic' && this.function_depth <= 1) { + if ( + node.name.startsWith('$') && + declaration_kind !== 'synthetic' && + declaration_kind !== 'param' && + declaration_kind !== 'rest_param' && + this.function_depth <= 1 + ) { error(node, 'invalid-dollar-prefix'); }