Type Aliases

Type aliases allow you to give a new name to a type. This can be helpful for readability and when working with complex types.

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


Create a type alias for a Rectangle which contains properties for its width and height. Also, define a function that takes a Rectangle as its argument and returns the area of that rectangle.

Copyright © learn-ts.org. Read our Terms of Use and Privacy Policy