type
Declares a type alias that names any type expression.
Syntax
type Name<Params> = TypeExpression Examples
type ID = string | number;
type Point = { x: number; y: number };
type Pair<T> = [T, T];
type Handler = (event: string) => void;
const onClick: Handler = (e) => console.log(e);
Notes
A type alias creates a new name for a type; it does not create a new distinct
type. Unlike `interface`, aliases cannot be reopened and merged but can name
unions, tuples, primitives, and conditional or mapped types. Aliases can be
generic and recursive.