TypeScript Syntax and Type Operators
type — type alias declaration
A type alias introduces a name for a type expression, including a union, primitive or object. It does not create a runtime value or a new nominal identity. An alias cannot be reopened with a second declaration of the same name in the same scope; an interface can participate in declaration merging. Choose an alias when the named expression is not simply an extendable object contract. Example output: "done". Tested in the strict TypeScript 5.8.3 / ES2022 baseline; the example is not a runtime type validator.
Formal Syntax & Structure
typescript syntaxtypescript
type Point = { x: number; y: number };Working Example
Example Snippettypescript
type Status = "queued" | "done";const state: Status = "done";console.log(state);