Computed class properties (#4500)
* Support computed class property names (#4499) ** Depends on babel/babylon#121 ** * `babel-types`: Add `computed` field to `ClassProperty` * `babel-plugin-transform-class-properties`: handle computed property names correctly * `babel-generator`: add tests for class properties (computed/literal, static/instance) * doc: Update babel-types with ClassProperty.computed * chore(package): update babylon to v6.11.0 * babel-types: move ClassProperty.computed to be last builder arg
This commit is contained in:
committed by
Daniel Tschinder
parent
a81a0d0f84
commit
03d772c2ec
@@ -55,7 +55,13 @@ export function ClassProperty(node: Object) {
|
||||
this.word("static");
|
||||
this.space();
|
||||
}
|
||||
this.print(node.key, node);
|
||||
if (node.computed) {
|
||||
this.token("[");
|
||||
this.print(node.key, node);
|
||||
this.token("]");
|
||||
} else {
|
||||
this.print(node.key, node);
|
||||
}
|
||||
this.print(node.typeAnnotation, node);
|
||||
if (node.value) {
|
||||
this.space();
|
||||
|
||||
Reference in New Issue
Block a user