using type alias

Used normally to give a new name for existing type or construct a new type. type ContactAddress = string it is actual string type but has different name. other useful uses can be:

typeof

keyof

retrive properties/keys as union like type title = keyof User so it can be used later with something like indexed access types.

indexed access types

Get type by access property like:

{ contactId: Contact["id"]; }

contactId here will be of type same as property "id" of Contact.

using Record

Modules

Declaration merging

Running it