Skip to content

formatter: Diff with Prettier on generic parameter trailing comma in .mts #18924

@StyleShit

Description

@StyleShit

Input

// index.mts
const fn = <T,>() => {}

Config

{}

Oxfmt output

Oxfmt version: latest

// index.mts
const fn = <T>() => {};

Oxfmt playground link

https://playground.oxc.rs/?t=formatter&formatterPanels=output%2Cprettier&code=const+fn+%3D+%3CT%2C%3E%28%29+%3D%3E+%7B%7D

Prettier output

Prettier version: 3.8.1

// index.mts
const fn = <T,>() => {};

Prettier playground link

No response

Additional notes

After the comma is automatically removed, ts/oxc throws an error:

Oxc Error: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions