Interface Properties in TypeScript

Let's say we have an interface that describes a user:

typescriptinterface IUser {
  
}

Let's add properties and their type to this interface:

typescriptinterface IUser {
  name: string;
  age: number;
}

Now we create an interface object. To do this, we declare a variable in which we specify the selected interface as the type:

typescriptlet user: IUser;

Now we can write values ​​for the properties defined in the interface:

typescriptlet user: IUser = {
  name: 'john',
  age: 30
}

If we now try to create a user without setting the required properties, we will see an error:

typescriptlet user: IUser = {
  name: 'john',  // 
}

There will also be an error if you try to make an extra property:

typescriptlet user: IUser = {
  name: 'john',
  surn: 'smit', // error age: 30
}
Задание 1

Create an interface IMath with properties num1 and num2.

Задание 2

Implement the calc object of the interface created above.