Skip to content

Commit b874e04

Browse files
committed
fix: prune typescript class field declarations
1 parent 6a7df1c commit b874e04

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.changeset/neat-lemons-occur.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: prune typescript class field declarations

packages/svelte/src/compiler/phases/1-parse/remove_typescript_nodes.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ const visitors = {
115115
TSDeclareFunction() {
116116
return b.empty;
117117
},
118+
ClassBody(node, context) {
119+
const body = [];
120+
for (const _child of node.body) {
121+
const child = context.visit(_child);
122+
if (child.type !== 'PropertyDefinition' || !child.declare) {
123+
body.push(child);
124+
}
125+
}
126+
return {
127+
...node,
128+
body
129+
};
130+
},
118131
ClassDeclaration(node, context) {
119132
if (node.declare) {
120133
return b.empty;

0 commit comments

Comments
 (0)