Custom Type with Function in TypeScript

Sometimes it is more convenient to declare a separate type that will contain a description of the parameters and return value of the function:

typescripttype Func = (x: number, y: number) => number;

Then you can declare functions with that type.

Let's declare a function that adds two numbers as an example:

typescriptlet func1: Func = function(a: number, b: number): number {
  return a + b;
};

Now let's declare a function that multiplies two numbers:

typescriptlet func2: Func = function(a: number, b: number): number {
  return a * b;
};
Задание 1

The following type is given:

typescripttype Func = (x: number, y: number, z: number) => number;

Make a function of this type. Let the function receive three numbers as a parameter, and return the sum of these numbers as its result.

Задание 2

Declare a function type that takes a number and an array of numbers as parameters and returns an array of numbers as a result.