Fix @babel/generator does not print decorators of private properties (#12081)

This commit is contained in:
Ananda Umamil 2020-09-25 20:16:28 +07:00 committed by GitHub
parent 6d87f46a7a
commit af612db8c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 0 deletions

View File

@ -101,6 +101,7 @@ export function ClassProperty(node: Object) {
}
export function ClassPrivateProperty(node: Object) {
this.printJoin(node.decorators, node);
if (node.static) {
this.word("static");
this.space();

View File

@ -0,0 +1,7 @@
class A {
@dec
foo;
@dec
#bar;
}

View File

@ -0,0 +1,9 @@
{
"plugins": [
["decorators", { "decoratorsBeforeExport": false }],
"classProperties",
"classPrivateProperties",
"classPrivateMethods"
],
"decoratorsBeforeExport": true
}

View File

@ -0,0 +1,6 @@
class A {
@dec
foo;
@dec
#bar;
}