Skip to content

Commit c8ef540

Browse files
authored
fix: improve each_key_without_as error (#16983)
1 parent bd2d3db commit c8ef540

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/three-wasps-work.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: improve `each_key_without_as` error

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @import { Expression } from 'estree' */
12
/** @import { AST, Binding } from '#compiler' */
23
/** @import { Context } from '../types' */
34
/** @import { Scope } from '../../scope' */
@@ -29,7 +30,7 @@ export function EachBlock(node, context) {
2930
}
3031

3132
if (node.metadata.keyed && !node.context) {
32-
e.each_key_without_as(node);
33+
e.each_key_without_as(/** @type {Expression} */ (node.key));
3334
}
3435

3536
// evaluate expression in parent scope

0 commit comments

Comments
 (0)