Fix yet another form of class with the same ast (#1849)

Fixes #1847
This commit is contained in:
Christopher Chedeau authored and GitHub committed 2017-06-01 19:02:15 -07:00
1 parent 4bfeb9064d
commit 3f8c4d6974
3 files changed
+18 -2

No files matched your search

+3 -2
View File
@@ -1868,9 +1868,10 @@ function genericPrintNoParens(path, options, print, args) {
const parentParentParent = path.getParentNode(2);
let isArrowFunctionTypeAnnotation =
n.type === "TSFunctionType" ||
!((!getFlowVariance(parent) &&
!((parent.type === "ObjectTypeProperty" &&
!getFlowVariance(parent) &&
!parent.optional &&
parent.type === "ObjectTypeProperty") ||
util.locStart(parent) === util.locStart(n)) ||
parent.type === "ObjectTypeCallProperty" ||
(parentParentParent &&
parentParentParent.type === "DeclareFunction"));
@@ -23,6 +23,11 @@ type T = { method(): void };
declare class X { method(): void }
declare function f(): void;
var f: () => void;
declare class X {
static deserialize(): mixed,
static deserialize: () => mixed,
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type T = { method: () => void };
type T = { method(): void };
@@ -30,4 +35,9 @@ declare class X { method(): void }
declare function f(): void;
var f: () => void;
declare class X {
static deserialize(): mixed,
static deserialize: () => mixed
}
`;
+5
View File
@@ -3,3 +3,8 @@ type T = { method(): void };
declare class X { method(): void }
declare function f(): void;
var f: () => void;
declare class X {
static deserialize(): mixed,
static deserialize: () => mixed,
}