Skip to content

formatter: Diff with Prettier on reduce with second param using TS generics #17871

@maybebot

Description

@maybebot

Input

type SomeType<T> = any;
type OtherType = any;

const x = [].reduce(() => {
  return "y";
}, {} as SomeType<OtherType>);

Config

{}

Oxfmt output

Oxfmt version: 0.23.0

type SomeType<T> = any;
type OtherType = any;

const x = [].reduce(
  () => {
    return "y";
  },
  {} as SomeType<OtherType>,
);

Oxfmt playground link

No response

Prettier output

Prettier version: 3.7.4

type SomeType<T> = any;
type OtherType = any;

const x = [].reduce(() => {
  return "y";
}, {} as SomeType<OtherType>);

Prettier playground link

No response

Additional notes

I can only speculate it has something to do with the generic bracket notation <OtherType>. Without using a generic there are no formatting differences

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions