Skip to content

Typescript: trailing comma in interface is not allowed #1858

@dotlouis

Description

@dotlouis

Hi, I just ran prettier on my code base and had only a single issue which comes from an interface.

Demo

generated TS:

export interface ShopQueryResult {
  chic: boolean;
  location: number[];
  menus: Menu[];
  openingDays: number[];
  closingDays: [
    {
      from: string,
      to: string,
    }, // <== this one
  ];
  shop: string;
  distance: number;
}

It basically comes down to the trailing comma inside the closingDays array, after the object literal.
Typescript compiler is not happy with it. Don't know why. My guess is that it should be accepted like any other trailing commas but it's probably easier to fix prettier than typescript.

Thanks a lot for this awesome tool, I look forward to use it a lot more,
Cheers

Metadata

Metadata

Assignees

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.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions