Skip to content

Commit e38975e

Browse files
authored
fix: remove unwanted properties from both replaced and unreplaced nodes (#14744)
1 parent 00ff60e commit e38975e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.changeset/famous-mugs-rhyme.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: remove unwanted properties from both replaced and unreplaced nodes

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ function remove_this_param(node, context) {
1818
/** @type {Visitors<any, null>} */
1919
const visitors = {
2020
_(node, context) {
21-
context.next();
21+
const n = context.next() ?? node;
2222

2323
// TODO there may come a time when we decide to preserve type annotations.
2424
// until that day comes, we just delete them so they don't confuse esrap
25-
delete node.typeAnnotation;
26-
delete node.typeParameters;
27-
delete node.returnType;
28-
delete node.accessibility;
25+
delete n.typeAnnotation;
26+
delete n.typeParameters;
27+
delete n.returnType;
28+
delete n.accessibility;
2929
},
3030
Decorator(node) {
3131
e.typescript_invalid_feature(node, 'decorators (related TSC proposal is not stage 4 yet)');

0 commit comments

Comments
 (0)