Yes, it is right, you do not need to specify any parameter in the TypeScript function, all you need is to use the rest syntax together with the array variable type assigned to that argument as follows:-
function add(...args:number[]) : number { let total = 0 for(let i in args) { total += args[i] } return total }
The rest syntax is the one with three dots in front of the array argument with the number type. After this, you can enter any numbers into the above function such as:-
console.log(add(3,4,5,6,7,8,10,43,78)) /* 164 */
The above function will add up all those numbers and return the total of all those numbers. The numbers that you have entered into the function will turn into an array which you can then add all the numbers within the array up in the ‘for’ loop!