Skip to content

TypeScript: "comment not printed" between MethodDefinition and its semicolon #9324

@thorn0

Description

@thorn0

Same thing happens with TSAbstractMethodDefinition.

Prettier 2.1.2
Playground link

--parser typescript

Input:

class foo1 {
  bar() /* bat */;
}

Output:

Error: Comment "bat" was not printed. Please report this error!
    at https://prettier.io/lib/standalone.js:15:106002
    at Array.forEach (<anonymous>)
    at Object.ensureAllCommentsPrinted (https://prettier.io/lib/standalone.js:15:105970)
    at Xi (https://prettier.io/lib/standalone.js:15:111682)
    at Yi (https://prettier.io/lib/standalone.js:15:113795)
    at formatWithCursor (https://prettier.io/lib/standalone.js:15:113915)
    at https://prettier.io/lib/standalone.js:15:386874
    at Object.format (https://prettier.io/lib/standalone.js:15:386957)
    at formatCode (https://prettier.io/worker.js:115:21)
    at handleMessage (https://prettier.io/worker.js:66:18)

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions