js-assistant
js-assistant copied to clipboard
Remove braces from arrow function produces broken code when line includes cast
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:
Output:
Expected output: