Skip to content

Comments in typescript type unions move to incorrect place #10344

@Naddiseo

Description

@Naddiseo

Prettier 2.2.1
Playground link

--parser typescript
--trailing-comma all

Input:

type Foo = "1" | "2" /* two */ | "3";

const Foo = "1" | "2" /*two*/ | "3";

Output:

type Foo = "1" | "2" | /* two */ "3";

const Foo = "1" | "2" /*two*/ | "3";

Expected behavior:
The comment should stay on the correct side of the | (like it does with const):

type Foo = "1" | "2" /* two */ | "3";

const Foo = "1" | "2" /*two*/ | "3";

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:commentsIssues with how Prettier prints commentsarea:union typeslang:flowIssues affecting Flow-specific constructs (not general JS issues)lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-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