Skip to content

Remove braces from arrow function produces broken code when line includes cast #82

@mprisehk

Description

@mprisehk

Minimal example:

type User = { id: number; name: string }

const userNames = ['Alice', 'Bob']

const users = userNames
  .filter(x => !!x)
  .map((userName, i) => {
    return { id: i, name: userName } as unknown as User
  })

Choose the 'Remove braces from arrow function' refactoring for the content of the 'map' function:
image

Output:
image

Expected output:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions