Type Aliases
A type alias gives a name to any type using the type keyword. It makes long or repeated types easier to read and reuse.
Aliases can name object shapes, unions, or primitives, and the name can be used anywhere a type is expected.
type ID = string | number;
type Point = { x: number; y: number };
Aliases do not create new types at runtime. They are erased when the code compiles.
Try it yourself
Loading editor…