Skip to content

[3.9] Type unions squeeze into a single line #19733

Description

@VictorGlindasPaf

I've enjoyed using Prettier for a long time, but I recently tried upgrading to prettier 3.9, but a lot of our code was reformatted to squeeze type untions into a single line for some reason? I think it's this one #18827, but it results in much worse formatted code, both for git diffs and readability.

v3.8

export type WorkerJob =
  | UpdateDataJob
  | UpdateEventsJob
  | UpdateOtherJob
  | UpdateSearchJob
  | UpdatePopularJob;

v3.9

export type WorkerJob =
  UpdateDataJob  | UpdateEventsJob  | UpdateOtherJob  | UpdateSearchJob  | UpdatePopularJob;

This 3.9 version is worse, since any changes in the type will now result in the whole line being git-diffed, while the old one had a proper diff & history tracking foreach union member.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)status:needs discussionIssues needing discussion and a decision to be made before action can be taken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions