Skip to content

Comment gets wrongly placed after readonly keyword in mapped type #11098

@MichaelDeBoey

Description

@MichaelDeBoey

Prettier 2.3.0
Playground link

--parser typescript

Input:

type Type = {
  // comment
  readonly [T in number]: OtherType[T];
};

Output:

type Type = {
  readonly // comment
  [T in number]: OtherType[T];
};

Expected behavior:

type Type = {
  // comment
  readonly [T in number]: OtherType[T];
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:commentsIssues with how Prettier prints commentslang: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

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions