Skip to content

Double slash comment // will be wrongly removed in the trailing position of the object attributeΒ #56055

@Azurewarth0920

Description

@Azurewarth0920

πŸ”Ž Search Terms

  • comment removal
  • removeComments

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried.

⏯ Playground Link

https://www.typescriptlang.org/play?ts=5.2.2#code/KYDwDg9gTgLgBAYwgOwM7wGYQnAvHAbwCg5S4sIAuOAcgpoBo4B6ZuGACwEtVEIBbfsGTwA7lwA2EuACNgcKMH4QAbsAAmAOhJkZAQyjUa+qDRZtOPPoOFjJ0uXADWwMDCYyArmI4BPbQC+QA

πŸ’» Code

export const foo = {
    foo: 'foo', // this comment will be removed, however this should be kept
    bar: 'bar' // this comment will be kept, works well
}

πŸ™ Actual behavior

export const foo = {
    foo: 'foo',
    bar: 'bar' // this comment will be kept, works well
}

πŸ™‚ Expected behavior

export const foo = {
    foo: 'foo', // this comment will be removed, however this should be kept
    bar: 'bar' // this comment will be kept, works well
}

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Comment EmitThe issue relates to the emission of comments when compilingHelp WantedYou can do thisPossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some cases

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions