Add method property to ObjectTypeProperty (#7005)

This commit is contained in:
Brian Ng
2017-12-11 09:32:16 -06:00
committed by GitHub
parent 42f66782be
commit f5ef928586
54 changed files with 1491 additions and 16 deletions

View File

@@ -182,7 +182,8 @@ export function FunctionTypeAnnotation(node: Object, parent: Object) {
// this node type is overloaded, not sure why but it makes it EXTREMELY annoying
if (
parent.type === "ObjectTypeCallProperty" ||
parent.type === "DeclareFunction"
parent.type === "DeclareFunction" ||
(parent.type === "ObjectTypeProperty" && parent.method)
) {
this.token(":");
} else {
@@ -437,8 +438,10 @@ export function ObjectTypeProperty(node: Object) {
this._variance(node);
this.print(node.key, node);
if (node.optional) this.token("?");
this.token(":");
this.space();
if (!node.method) {
this.token(":");
this.space();
}
this.print(node.value, node);
}