Arrow Functions in TypeScript

In TypeScript, you can also make arrow functions. Let's look at an example. Let's say we have the following function:

typescriptlet func = function(num: number): number {
  return num ** 2;
}

Let's rewrite this function to the arrow version:

typescriptlet func = (num: number): number => num ** 2;
Задание 1

Convert the following function to an arrow function:

typescriptlet func = function(num1: number, num2: number): number {
  return num1 + num2;
}
Задание 2

Convert the following function to an arrow function:

typescriptlet func = function(str: string): string[] {
  return str.split('');
}
Задание 3

Rewrite the following JavaScript code to TypeScript:

javascriptlet arr = [1, 2, 3];
let res = arr.map(num => num ** 2);

console.log(res);