01 / 05
Writing the same function for every type is a pain
Say you want a function that takes an array and returns the first item. You want it for arrays of strings and for arrays of numbers.
As things stand, you end up writing the same function over again, once per type.
function firstS(list: string[]): string { return list[0];}function firstN(list: number[]): number { return list[0];}console.log(firstS(["a", "b"]));console.log(firstN([3, 5]));Result
a 3