Repository: prettier/prettier (JavaScript)

Issue:
TypeScript constructor assignment improvement.
**Prettier 1.15.3**
[Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEcAeAHCAnGACMAGwEMBnUvAFTlJgGETy9gAdKPA6W7AVzBhwAKNhw4ZsASwBuxeHmIYJSPAEFFAZTjYpEsHAA0I0eOmy4nKADMJAc2V1o1m5u264RgJTMAvm28h9EAgMGAkuZFBibGwIAHcABSiEUmQQYikICQATAJAAI2xiMABrOBh1DCKJKBtkGF4DEAALGABbQgB1Jol4Ukq9TShSHukegE9UsHJc6tItGHjCm1biZEtiQjnAgCtSNAAhQpKy9WJWuAAZarg1ja2QXbR1aptCOABFHgh4W83Gyuwc2wqRgYwwNDAkhCuRMsA62RgTWQAA4AAyBcQQOYdQoYVLiGhaKQ3QLYOAARx4EjJi2Iy1WSHWf0Cc1aEjqDRZLzen2+N0Zd0aMGIeXhWURyAATIF6sQJIQXg5WitUlBoCSQDw5pQRSkBX9vN4gA)
```sh
--parser typescript
```

**Input:**
```tsx
export class TestClass {
  constructor(
    private api: ApiService,
    private config: ConfigService
  ) {}
}
```

**Output:**
```tsx
export class TestClass {
  constructor(private api: ApiService, private config: ConfigService) {}
}

```

**Expected behavior:**

Consider breaking line despite `printWidth` value (as input).
Since it visually should be close to:

```tsx
export class TestClass {
  private api: ApiService;
  private config: ConfigService;
}
```

and not:

```tsx
export class TestClass {
  private api: ApiService; private config: ConfigService;
}
```


Hints:
Is there any direct relation between "class properties" and "constructor arguments" in TypeScript? I don't use TypeScript so I really don't know. 

I'm aware that sometimes in constructor you want to do:

```js
constructor(foo, bar) {
  this.foo = foo;
  this.bar = bar;
}
```

But if this works like JS, and there's no direct relation between the arguments and the class properties, then I see no reason why it should be visually close to class properties, and no reason we should special case `constructor`.
It's a TypeScript-specific feature called [parameter property](https://www.typescriptlang.org/docs/handbook/classes.html#parameter-properties). I think we should not treat it differently since it can be used with normal parameter simultaneously:

```ts
export class TestClass {
  constructor(
    private api: ApiService,
    something: any,
    private config: ConfigService
  ) {}
}
```
Oh cool I didn't know.. in that case, we can discuss if it makes sense to add this, but I agree with @ikatyang we should not treat it differently.
> I think we should not treat it differently since it can be used with normal parameter simultaneously

Good point.


I would love to see this added -- anytime a parameter property is used multi-line the whole ctor. This makes features like reference code lens in vscode better:
![image](https://user-images.githubusercontent.com/641685/52997435-82ba6f00-33ee-11e9-8faf-e88cd92b0245.png)

Any way this could be re-opened?
@eamodio Can you provide a screenshot showing the vscode lens thing not working?
![image](https://user-images.githubusercontent.com/641685/53004012-3d9e3900-33fe-11e9-8400-b7f2225a7885.png)

They still work, but it is much clearer if they are each on their own line.
@lydell is this something that can be reconsidered and re-opened?
I’m familiar with the code that would have to change to do this and could work on this issue this weekend, but I’m not sure if there’s consensus to implement this yet? Personally, as an avid typescript user I think putting parameter properties on their own lines (even if there are non-property parameters in between) is a good idea.
I would love to have this introduced, this would make the code much easier to read.

This format that Prettier is applying now is making it very hard to understand that there are multiple class properties defined there, making this Typescript feature much less apealing:

``` 
export class TestClass {
  constructor(private api: ApiService, private config: ConfigService, autoConnect: boolean) {}
}

// vs

export class TestClass {
  constructor(
    private api: ApiService,
    private config: ConfigService,
    autoConnect: boolean
  ) {}
}
```

I suggest introducing this feature as a new option.
```
--typescript-parameter-prop-multi-line <never|allways|preserve>
> never (default) - working as today
> allways - apply multi line format every time there's at least one parameter property
> preserve - keep existing format decision
```

Thanks!
That's why prettier should have more options in configuration. This formatting rule is a deal-breaker to me, as an Angular developer.

Having this in one file
```ts
  constructor(private form: NgForm, private ngbModal: NgbModal, private commonDialogsService: CommonDialogsService) {}
```
but this in another file
```
  constructor(
    private title: Title,
    private form: NgForm,
    private ngbModal: NgbModal,
    private commonDialogsService: CommonDialogsService,
  ) {}
```
is just not acceptable. It's inconsistent, it's hard to scan, it makes the code harder to understand.
I think that putting each constructor parameter on their own line if there are any parameter properties helps a lot with code readability.

In addition to helping with code readability, it helps avoid merge conflicts and reduce diff sizes in line-based version control.

I think it would be an improvement to Prettier to change this without adding an additional configuration option.

```typescript
    constructor(foo: string, private bar: number) {}
```

would change to

```typescript
    constructor(
        foo: string,
        private bar: number,
    ) {}
```

An alternative approach to a unilateral change or a new configuration variable is to honor whether someone has entered a trailing comma in their constructor parameter list, then people could opt-in to multi-line constructor parameters by writing

```typescript
    constructor(foo: string, private bar: number,) {}
```
I think that this should be a configuration option for typescript. We've decided internally to currently force it by putting in a trailing comment after the first parameter as below but preference would be just to have config we can turn on that would do this for us.

```
constructor(
        public foo: string, //
        private bar: number,
    ) {}
```
The most elegant solution to this, until there is a specific rule in place, is to add the `// prettier-ignore` trigger before the constructor. The empty comment, `//`, solution doesn't let other developers know what it's doing.

I believe that there should be a constructor specific rule. In Angular and because of dependency injection, the constructor tends to have more than normal amounts of parameters. 
Bump - would love this to be resolved! It's definitely annoying as is.
Let's do this when at least one parameter is a parameter property.
Bumping this. It's not just annoying, it's a deal-breaker for working in any serious Angular project.
Not only is it unclear to read, but it also create tons of avoidable merge conflicts.
Any update on this? Or solution that it's not a patch like `//`? Thanks!
For me it's unbelievable this issue is 4yrs old and no one did it.
Hi! Me and two classmates was gonna work on this issue for our masters class at Uni. 
We have tried to replicate the problem and found that prettier puts the parameters on different lines based on characters per line and not the amount of parameters. If you have any helpful input or advice we are all ears, thanks!

Patch:
diff --git a/src/language-js/print/function-parameters.js b/src/language-js/print/function-parameters.js
--- a/src/language-js/print/function-parameters.js
+++ b/src/language-js/print/function-parameters.js
@@ -279,8 +279,17 @@ function isDecoratedFunction(path) {
   );
 }
 
+function shouldBreakFunctionParameters(functionNode) {
+  const parameters = getFunctionParameters(functionNode);
+  return (
+    parameters.length > 1 &&
+    parameters.some((parameter) => parameter.type === "TSParameterProperty")
+  );
+}
+
 export {
   printFunctionParameters,
   shouldHugTheOnlyFunctionParameter,
   shouldGroupFunctionParameters,
+  shouldBreakFunctionParameters,
 };
diff --git a/src/language-js/print/function.js b/src/language-js/print/function.js
--- a/src/language-js/print/function.js
+++ b/src/language-js/print/function.js
@@ -41,6 +41,7 @@ import { locEnd } from "../loc.js";
 import {
   printFunctionParameters,
   shouldGroupFunctionParameters,
+  shouldBreakFunctionParameters,
 } from "./function-parameters.js";
 import { printPropertyKey } from "./property.js";
 import { printFunctionTypeParameters, printDeclareToken } from "./misc.js";
@@ -171,6 +172,7 @@ function printMethodValue(path, options, print) {
   const { node } = path;
   const parametersDoc = printFunctionParameters(path, print, options);
   const returnTypeDoc = printReturnType(path, print);
+  const shouldBreakParameters = shouldBreakFunctionParameters(node);
   const shouldGroupParameters = shouldGroupFunctionParameters(
     node,
     returnTypeDoc
@@ -178,7 +180,11 @@ function printMethodValue(path, options, print) {
   const parts = [
     printFunctionTypeParameters(path, options, print),
     group([
-      shouldGroupParameters ? group(parametersDoc) : parametersDoc,
+      shouldBreakParameters
+        ? group(parametersDoc, { shouldBreak: true })
+        : shouldGroupParameters
+        ? group(parametersDoc)
+        : parametersDoc,
       returnTypeDoc,
     ]),
   ];


Test patch:
diff --git a/tests/format/misc/errors/typescript/modifiers/__snapshots__/jsfmt.spec.js.snap b/tests/format/misc/errors/typescript/modifiers/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/misc/errors/typescript/modifiers/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/misc/errors/typescript/modifiers/__snapshots__/jsfmt.spec.js.snap
@@ -2213,174 +2213,222 @@ exports[`snippet: #163 [typescript] format 1`] = `
 `;
 
 exports[`snippet: #164 [babel-ts] format 1`] = `
+"A parameter property is only allowed in a constructor implementation. (1:28)
+> 1 | class Foo {["constructor"](private parameter) {}}
+    |                            ^"
+`;
+
+exports[`snippet: #164 [typescript] format 1`] = `
+"A parameter property is only allowed in a constructor implementation. (1:28)
+> 1 | class Foo {["constructor"](private parameter) {}}
+    |                            ^^^^^^^"
+`;
+
+exports[`snippet: #165 [babel-ts] format 1`] = `
+"A parameter property is only allowed in a constructor implementation. (1:28)
+> 1 | class Foo {['constructor'](private parameter) {}}
+    |                            ^"
+`;
+
+exports[`snippet: #165 [typescript] format 1`] = `
+"A parameter property is only allowed in a constructor implementation. (1:28)
+> 1 | class Foo {['constructor'](private parameter) {}}
+    |                            ^^^^^^^"
+`;
+
+exports[`snippet: #166 [babel-ts] format 1`] = `
+"A parameter property is only allowed in a constructor implementation. (1:28)
+> 1 | class Foo {[\`constructor\`](private parameter) {}}
+    |                            ^"
+`;
+
+exports[`snippet: #166 [typescript] format 1`] = `
+"A parameter property is only allowed in a constructor implementation. (1:28)
+> 1 | class Foo {[\`constructor\`](private parameter) {}}
+    |                            ^^^^^^^"
+`;
+
+exports[`snippet: #167 [babel-ts] format 1`] = `
+"A parameter property is only allowed in a constructor implementation. (1:33)
+> 1 | class Foo {['const' + 'ructor'](private parameter) {}}
+    |                                 ^"
+`;
+
+exports[`snippet: #167 [typescript] format 1`] = `
+"A parameter property is only allowed in a constructor implementation. (1:33)
+> 1 | class Foo {['const' + 'ructor'](private parameter) {}}
+    |                                 ^^^^^^^"
+`;
+
+exports[`snippet: #168 [babel-ts] format 1`] = `
 "'abstract' modifier cannot appear on a type member. (1:13)
 > 1 | type Foo = {abstract bar};
     |             ^"
 `;
 
-exports[`snippet: #164 [typescript] format 1`] = `
+exports[`snippet: #168 [typescript] format 1`] = `
 "'abstract' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {abstract bar};
     |             ^^^^^^^^"
 `;
 
-exports[`snippet: #165 [babel-ts] format 1`] = `
+exports[`snippet: #169 [babel-ts] format 1`] = `
 "Unexpected token, expected ";" (1:22)
 > 1 | type Foo = {accessor bar};
     |                      ^"
 `;
 
-exports[`snippet: #165 [typescript] format 1`] = `
+exports[`snippet: #169 [typescript] format 1`] = `
 "'accessor' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {accessor bar};
     |             ^^^^^^^^"
 `;
 
-exports[`snippet: #166 [babel-ts] format 1`] = `
+exports[`snippet: #170 [babel-ts] format 1`] = `
 "Unexpected token, expected ";" (1:19)
 > 1 | type Foo = {async bar};
     |                   ^"
 `;
 
-exports[`snippet: #166 [typescript] format 1`] = `
+exports[`snippet: #170 [typescript] format 1`] = `
 "'async' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {async bar};
     |             ^^^^^"
 `;
 
-exports[`snippet: #167 [babel-ts] format 1`] = `
+exports[`snippet: #171 [babel-ts] format 1`] = `
 "Unexpected token, expected ";" (1:19)
 > 1 | type Foo = {const bar};
     |                   ^"
 `;
 
-exports[`snippet: #167 [typescript] format 1`] = `
+exports[`snippet: #171 [typescript] format 1`] = `
 "';' expected. (1:19)
 > 1 | type Foo = {const bar};
     |                   ^"
 `;
 
-exports[`snippet: #168 [babel-ts] format 1`] = `
+exports[`snippet: #172 [babel-ts] format 1`] = `
 "'declare' modifier cannot appear on a type member. (1:13)
 > 1 | type Foo = {declare bar};
     |             ^"
 `;
 
-exports[`snippet: #168 [typescript] format 1`] = `
+exports[`snippet: #172 [typescript] format 1`] = `
 "'declare' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {declare bar};
     |             ^^^^^^^"
 `;
 
-exports[`snippet: #169 [babel-ts] format 1`] = `
+exports[`snippet: #173 [babel-ts] format 1`] = `
 "Unexpected token, expected ";" (1:21)
 > 1 | type Foo = {default bar};
     |                     ^"
 `;
 
-exports[`snippet: #169 [typescript] format 1`] = `
+exports[`snippet: #173 [typescript] format 1`] = `
 "';' expected. (1:21)
 > 1 | type Foo = {default bar};
     |                     ^"
 `;
 
-exports[`snippet: #170 [babel-ts] format 1`] = `
+exports[`snippet: #174 [babel-ts] format 1`] = `
 "Unexpected token, expected ";" (1:20)
 > 1 | type Foo = {export bar};
     |                    ^"
 `;
 
-exports[`snippet: #170 [typescript] format 1`] = `
+exports[`snippet: #174 [typescript] format 1`] = `
 "'export' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {export bar};
     |             ^^^^^^"
 `;
 
-exports[`snippet: #171 [babel-ts] format 1`] = `
+exports[`snippet: #175 [babel-ts] format 1`] = `
 "Unexpected token, expected ";" (1:16)
 > 1 | type Foo = {in bar};
     |                ^"
 `;
 
-exports[`snippet: #171 [typescript] format 1`] = `
+exports[`snippet: #175 [typescript] format 1`] = `
 "'in' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {in bar};
     |             ^^"
 `;
 
-exports[`snippet: #172 [babel-ts] format 1`] = `
+exports[`snippet: #176 [babel-ts] format 1`] = `
 "Unexpected token, expected ";" (1:17)
 > 1 | type Foo = {out bar};
     |                 ^"
 `;
 
-exports[`snippet: #172 [typescript] format 1`] = `
+exports[`snippet: #176 [typescript] format 1`] = `
 "'out' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {out bar};
     |             ^^^"
 `;
 
-exports[`snippet: #173 [babel-ts] format 1`] = `
+exports[`snippet: #177 [babel-ts] format 1`] = `
 "'override' modifier cannot appear on a type member. (1:13)
 > 1 | type Foo = {override bar};
     |             ^"
 `;
 
-exports[`snippet: #173 [typescript] format 1`] = `
+exports[`snippet: #177 [typescript] format 1`] = `
 "'override' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {override bar};
     |             ^^^^^^^^"
 `;
 
-exports[`snippet: #174 [babel-ts] format 1`] = `
+exports[`snippet: #178 [babel-ts] format 1`] = `
 "'private' modifier cannot appear on a type member. (1:13)
 > 1 | type Foo = {private bar};
     |             ^"
 `;
 
-exports[`snippet: #174 [typescript] format 1`] = `
+exports[`snippet: #178 [typescript] format 1`] = `
 "'private' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {private bar};
     |             ^^^^^^^"
 `;
 
-exports[`snippet: #175 [babel-ts] format 1`] = `
+exports[`snippet: #179 [babel-ts] format 1`] = `
 "'protected' modifier cannot appear on a type member. (1:13)
 > 1 | type Foo = {protected bar};
     |             ^"
 `;
 
-exports[`snippet: #175 [typescript] format 1`] = `
+exports[`snippet: #179 [typescript] format 1`] = `
 "'protected' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {protected bar};
     |             ^^^^^^^^^"
 `;
 
-exports[`snippet: #176 [babel-ts] format 1`] = `
+exports[`snippet: #180 [babel-ts] format 1`] = `
 "'public' modifier cannot appear on a type member. (1:13)
 > 1 | type Foo = {public bar};
     |             ^"
 `;
 
-exports[`snippet: #176 [typescript] format 1`] = `
+exports[`snippet: #180 [typescript] format 1`] = `
 "'public' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {public bar};
     |             ^^^^^^"
 `;
 
-exports[`snippet: #177 [babel-ts] format 1`] = `
+exports[`snippet: #181 [babel-ts] format 1`] = `
 "'static' modifier cannot appear on a type member. (1:13)
 > 1 | type Foo = {static bar};
     |             ^"
 `;
 
-exports[`snippet: #177 [typescript] format 1`] = `
+exports[`snippet: #181 [typescript] format 1`] = `
 "'static' modifier cannot appear on a type member (1:13)
 > 1 | type Foo = {static bar};
     |             ^^^^^^"
 `;
 
-exports[`snippet: #178 [babel-ts] format 1`] = `
+exports[`snippet: #182 [babel-ts] format 1`] = `
 "Index signatures cannot have the 'declare' modifier. (2:3)
   1 | class Foo {
 > 2 |   declare [index: string]: number
@@ -2388,7 +2436,7 @@ exports[`snippet: #178 [babel-ts] format 1`] = `
   3 | }"
 `;
 
-exports[`snippet: #178 [typescript] format 1`] = `
+exports[`snippet: #182 [typescript] format 1`] = `
 "'declare' modifier cannot appear on an index signature (2:3)
   1 | class Foo {
 > 2 |   declare [index: string]: number
diff --git a/tests/format/misc/errors/typescript/modifiers/jsfmt.spec.js b/tests/format/misc/errors/typescript/modifiers/jsfmt.spec.js
--- a/tests/format/misc/errors/typescript/modifiers/jsfmt.spec.js
+++ b/tests/format/misc/errors/typescript/modifiers/jsfmt.spec.js
@@ -103,6 +103,11 @@ run_spec(
       ).map(
         (modifier) => `class Foo { constructor(${modifier} parameter) {} }`
       ),
+      'class Foo {["constructor"](private parameter) {}}',
+      "class Foo {['constructor'](private parameter) {}}",
+      "class Foo {[`constructor`](private parameter) {}}",
+      // cspell:disable-next-line
+      "class Foo {['const' + 'ructor'](private parameter) {}}",
 
       // `TSPropertySignature`
       ...POSSIBLE_MODIFIERS.filter((modifier) => modifier !== "readonly").map(
diff --git a/tests/format/typescript/class/__snapshots__/jsfmt.spec.js.snap b/tests/format/typescript/class/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/typescript/class/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/typescript/class/__snapshots__/jsfmt.spec.js.snap
@@ -450,6 +450,65 @@ class A {
 ================================================================================
 `;
 
+exports[`parameter-properties.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+                                                                                | printWidth
+=====================================input======================================
+class MyClass {
+  constructor(protected x: number, private y: string) {
+  }
+}
+
+[
+  class {
+    "constructor"(protected x: number, private y: string) {
+    }
+  },
+]
+
+class Mixed {
+  constructor(public a: number, b: unknown) {
+  }
+}
+
+class OneParameterProperty {
+  constructor(public foobar: boolean) {
+  }
+}
+
+=====================================output=====================================
+class MyClass {
+  constructor(
+    protected x: number,
+    private y: string,
+  ) {}
+}
+
+[
+  class {
+    constructor(
+      protected x: number,
+      private y: string,
+    ) {}
+  },
+];
+
+class Mixed {
+  constructor(
+    public a: number,
+    b: unknown,
+  ) {}
+}
+
+class OneParameterProperty {
+  constructor(public foobar: boolean) {}
+}
+
+================================================================================
+`;
+
 exports[`quoted-property.ts format 1`] = `
 ====================================options=====================================
 parsers: ["typescript"]
diff --git a/tests/format/typescript/class/parameter-properties.ts b/tests/format/typescript/class/parameter-properties.ts
new file mode 100644
--- /dev/null
+++ b/tests/format/typescript/class/parameter-properties.ts
@@ -0,0 +1,21 @@
+class MyClass {
+  constructor(protected x: number, private y: string) {
+  }
+}
+
+[
+  class {
+    "constructor"(protected x: number, private y: string) {
+    }
+  },
+]
+
+class Mixed {
+  constructor(public a: number, b: unknown) {
+  }
+}
+
+class OneParameterProperty {
+  constructor(public foobar: boolean) {
+  }
+}
diff --git a/tests/format/typescript/conformance/classes/__snapshots__/jsfmt.spec.js.snap b/tests/format/typescript/conformance/classes/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/typescript/conformance/classes/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/typescript/conformance/classes/__snapshots__/jsfmt.spec.js.snap
@@ -348,11 +348,18 @@ class Thing3 extends Thing2 {
 type Constructor<T> = new (...args: any[]) => T;
 
 class Base {
-  constructor(public x: number, public y: number) {}
+  constructor(
+    public x: number,
+    public y: number,
+  ) {}
 }
 
 class Derived extends Base {
-  constructor(x: number, y: number, public z: number) {
+  constructor(
+    x: number,
+    y: number,
+    public z: number,
+  ) {
     super(x, y);
   }
 }
@@ -485,11 +492,18 @@ const Timestamped = <CT extends Constructor<object>>(Base: CT) => {
 type Constructor<T> = new (...args: any[]) => T;
 
 class Base {
-  constructor(public x: number, public y: number) {}
+  constructor(
+    public x: number,
+    public y: number,
+  ) {}
 }
 
 class Derived extends Base {
-  constructor(x: number, y: number, public z: number) {
+  constructor(
+    x: number,
+    y: number,
+    public z: number,
+  ) {
     super(x, y);
   }
 }
diff --git a/tests/format/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap b/tests/format/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap
@@ -120,7 +120,10 @@ class C {
 
 class D<T, U> {
   constructor(x: T, y: U);
-  constructor(x: T = 1, public y: U = x) {
+  constructor(
+    x: T = 1,
+    public y: U = x,
+  ) {
     var z = x;
   }
 }
@@ -235,7 +238,10 @@ var r4 = d.z; // error
 =====================================output=====================================
 class C {
   y: string;
-  constructor(private x: string, protected z: string) {}
+  constructor(
+    private x: string,
+    protected z: string,
+  ) {}
 }
 
 var c: C;
@@ -245,7 +251,11 @@ var r3 = c.z; // error
 
 class D<T> {
   y: T;
-  constructor(a: T, private x: T, protected z: T) {}
+  constructor(
+    a: T,
+    private x: T,
+    protected z: T,
+  ) {}
 }
 
 var d: D<string>;
diff --git a/tests/format/typescript/conformance/internalModules/importDeclarations/__snapshots__/jsfmt.spec.js.snap b/tests/format/typescript/conformance/internalModules/importDeclarations/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/typescript/conformance/internalModules/importDeclarations/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/typescript/conformance/internalModules/importDeclarations/__snapshots__/jsfmt.spec.js.snap
@@ -128,7 +128,10 @@ var p: M.D.Point;
 module A {
   export var x = "hello world";
   export class Point {
-    constructor(public x: number, public y: number) {}
+    constructor(
+      public x: number,
+      public y: number,
+    ) {}
   }
   export module B {
     export interface Id {
@@ -153,7 +156,10 @@ module X {
 
   export module Y {
     export class Point {
-      constructor(public x: number, public y: number) {}
+      constructor(
+        public x: number,
+        public y: number,
+      ) {}
     }
   }
 }
@@ -261,7 +267,10 @@ var p: { x: number; y: number; };
 =====================================output=====================================
 module moduleA {
   export class Point {
-    constructor(public x: number, public y: number) {}
+    constructor(
+      public x: number,
+      public y: number,
+    ) {}
   }
 }