Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mprisehk opened this issue Aug 1, 2024 · 0 comments

Comments

@mprisehk
Copy link

mprisehk commented Aug 1, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant