Skip to content

prettier still adds extra semicolon to typescript interface with @prettier-ignore #5451

@Swatinem

Description

@Swatinem

Prettier 1.15.2

Hm, seems like a different edge-case to #5160 that was recently fixed?

Playground link

Input:

declare const T: {};
interface T<T> {
  // prettier-ignore
  new<T>(): T<T>;
  t<T>(): T<T>;
}

Output:

declare const T: {};
interface T<T> {
  // prettier-ignore
  new<T>(): T<T>;;
  t<T>(): T<T>;
}

Expected behavior:

The extra semicolon is actually a parse error later on for typescript.
Prettier should not mess with that line, at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    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.priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions