// "hidden" in a utils/helper/whatever module, or library-like
function transformEachElement<A, B>(
elements: A,
action: (element: A) => B
): B[] {
const result = []
for (let i = 0; i < elements.length: i++) {
result.push(action(elements[i]))
}
return result
}
// What do we want? Double each number of a given list
const res = transformEachElement([1, 2, 3], n => n * 2)