Skip to content

Commit d313413

Browse files
committed
flush trailing comments after class properties
1 parent 17c22f5 commit d313413

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

src/languages/ts.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,12 @@ export default (options = {}) => {
11451145
}
11461146

11471147
context.write(';');
1148+
1149+
flush_trailing_comments(
1150+
context,
1151+
(node.value ?? node.typeAnnotation ?? node.key).loc.end,
1152+
null
1153+
);
11481154
},
11491155

11501156
RestElement: shared['RestElement|SpreadElement'],
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Foo {
2-
hi;
3-
static foo = 1;
4-
[KEY] = 2;
5-
}
2+
hi; // a
3+
static foo = 1; // b
4+
[KEY] = 2; // c
5+
}

test/samples/class-property/expected.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/samples/class-property/input.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Foo {
2-
hi;
3-
static foo = 1;
4-
[KEY] = 2;
5-
}
2+
hi; // a
3+
static foo = 1; // b
4+
[KEY] = 2; // c
5+
}

0 commit comments

Comments
 (0)