diff --git a/src/printer.js b/src/printer.js index 75c8351d..a57768a9 100644 --- a/src/printer.js +++ b/src/printer.js @@ -1664,9 +1664,6 @@ function genericPrintNoParens(path, options, print, args) { return concat(parts); case "ClassProperty": case "TSAbstractClassProperty": { - if (n.static) { - parts.push("static "); - } const variance = getFlowVariance(n); if (variance) { parts.push(variance); @@ -1674,6 +1671,9 @@ function genericPrintNoParens(path, options, print, args) { if (n.accessibility) { parts.push(n.accessibility + " "); } + if (n.static) { + parts.push("static "); + } if (n.type === "TSAbstractClassProperty") { parts.push("abstract "); } diff --git a/tests/typescript/conformance/classes/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/classes/__snapshots__/jsfmt.spec.js.snap index 15557bbf..6d67f30b 100644 --- a/tests/typescript/conformance/classes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/classes/__snapshots__/jsfmt.spec.js.snap @@ -149,25 +149,25 @@ class Private2 { class Protected { constructor(...args: any[]) {} protected p: string; - static protected s: string; + protected static s: string; } class Protected2 { constructor(...args: any[]) {} protected p: string; - static protected s: string; + protected static s: string; } class Public { constructor(...args: any[]) {} public p: string; - static public s: string; + public static s: string; } class Public2 { constructor(...args: any[]) {} public p: string; - static public s: string; + public static s: string; } function f1(x: Private & Private2) { diff --git a/tests/typescript_class/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_class/__snapshots__/jsfmt.spec.js.snap index fd701b7b..99c86b22 100644 --- a/tests/typescript_class/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript_class/__snapshots__/jsfmt.spec.js.snap @@ -51,6 +51,10 @@ class X { interface Iterable { export [Symbol.iterator](): Iterator; } + +export class Check { + private static property = 'test'; +} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class X { optionalMethod?() {} @@ -60,6 +64,10 @@ interface Iterable { export [Symbol.iterator](): Iterator; } +export class Check { + private static property = "test"; +} + `; exports[`optional.ts 1`] = ` diff --git a/tests/typescript_class/methods.ts b/tests/typescript_class/methods.ts index 7bdcdca8..799573c9 100644 --- a/tests/typescript_class/methods.ts +++ b/tests/typescript_class/methods.ts @@ -5,3 +5,7 @@ class X { interface Iterable { export [Symbol.iterator](): Iterator; } + +export class Check { + private static property = 'test'; +}