Type Aliases

Type aliases create a new name for a type. It does not actually create a new type, it merely creates a new name to refer to that type.

type Age = int;
type Coordinate = int[2];

They can also be used for struct types.

Struct definition:

struct Point {
  int x;
  int y;

Creating an alias for the defined struct:

type Coordinate = Point;