Rest function parameters in TypeScript
In TypeScript, you can also work with rest function parameters. To do this, the variable into which the parameters are stored should be declared as an array:
function func(...rest: number[]): void {
console.log(rest);
}
Let's check how our function works:
func(1, 2, 3); // will bring out [1, 2, 3]
Make a function that takes any number of numbers as parameters and returns their sum.