Search code examples
typescriptprettier

Prettier Typescript Constructor Parentheses


I have a project with prettier installed. And it always reformats the following code:

constructor(public url: string) {
}

To:

constructor(public url: string) {}

Is there an option to prevent this?


Solution

  • No. Prettier is an opinionated formatter so has limited options. The idea is to stop people worrying about irrelevant formatting details so they can spend their time doing something more useful.