Skip to content

Adding return type annotation to callback suddenly breaks call into multiple lines #6099

@Tetraib

Description

@Tetraib

Prettier 1.17.0
Playground link

--parser typescript

Input:

app.get("/", (req, res): void => {
  res.send("Hello World!");
});

Output:

app.get(
  "/",
  (req, res): void => {
    res.send("Hello World!");
  }
);

Expected behavior:

app.get("/", (req, res): void => {
  res.send("Hello World!");
});

As soon as you try to type the returned value for the function with ": void" it incorrectly breaks the function in multiple lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:javascriptIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions