function average average(list: number[]): number Calculates the average of the elements in the given list. If you pass a list of numbers, it calculates the average directly. If you pass a list of objects, provide the key to calculate the average. Examples Example 1 average([1, 2, 3]); // 2 average([{ x: 1 }, { x: 2 }], "x"); // 1.5 Parameters list: number[] Return Type number average<T extends Record<PropertyKey, number>>(list: T[],key: keyof T,): number Type Parameters T extends Record<PropertyKey, number> Parameters list: T[] key: keyof T Return Type number