menu
manual-map
Prefer Array.map over manually collecting transformed elements
Creating an array, pushing one transformed value for every input element, and returning it spells Array.map manually.
Instead, you SHOULD return the result of map directly.
Reported
1function doubled(values: int32[]): int32[] {2 const result: int32[] = [];3 for (const value of values) {4 result.push(value * 2);5 }6 return result;7}Accepted
1function doubled(values: int32[]): int32[] {2 return values.map((value) => value * 2);3}