type Point = {
    x: number;
    y: number;
};

const point: Point = {
    x: 10,
    y: 20
};

console.log(point);
Bash

Explanation:

  • This program creates a type alias Point that describes the structure of an object with x and y properties.
  • An object of type Point is created and logged to the console.
Resize text
Scroll to Top