TypeScript 7 · Types

Define a union type

Allow a value to be one of several types.

type Status = "idle" | "loading" | "error";
type Id = string | number;

Official TypeScript 7 documentation

More types commands

All types commands · TypeScript 7 cheatsheet

Was this page helpful?