Skip to content

Commit 5064161

Browse files
committed
fix: Allow @const inside #key
1 parent 3c4a8d4 commit 5064161

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

.changeset/healthy-guests-itch.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
Allow `@const` inside `#key`

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

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function ConstTag(node, context) {
2525
grand_parent?.type !== 'AwaitBlock' &&
2626
grand_parent?.type !== 'SnippetBlock' &&
2727
grand_parent?.type !== 'SvelteBoundary' &&
28+
grand_parent?.type !== 'KeyBlock' &&
2829
((grand_parent?.type !== 'RegularElement' && grand_parent?.type !== 'SvelteElement') ||
2930
!grand_parent.attributes.some((a) => a.type === 'Attribute' && a.name === 'slot')))
3031
) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{#key 'key'}
2+
{@const foo = 'bar'}
3+
{/key}

0 commit comments

Comments
 (0)