Skip to content

Commit

Permalink
fix: allow classes to be reassigned (#11794)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris authored May 27, 2024
1 parent 4fef0eb commit 5fb017d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gentle-wasps-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: allow classes to be reassigned
2 changes: 1 addition & 1 deletion packages/svelte/src/compiler/phases/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
SwitchStatement: create_block_scope,

ClassDeclaration(node, { state, next }) {
if (node.id) state.scope.declare(node.id, 'normal', 'const', node);
if (node.id) state.scope.declare(node.id, 'normal', 'let', node);
next();
},

Expand Down

0 comments on commit 5fb017d

Please sign in to comment.