Convert an array of strings to numbers

JavaScript version
const toNumbers = (arr) => arr.map(Number);
// Or
const toNumbers = (arr) => arr.map((x) => +x);
TypeScript version
const toNumbers = (arr: string[]): number[] => arr.map(Number);
// Or
const toNumbers = (arr: string[]): number[] => arr.map((x) => +x);
Example
toNumbers(['2', '3', '4']); // [2, 3, 4]