0Pricing
TypeScript Academy · Lesson

Pluralization with Types

Model plural forms in a type-safe way.

Type-Safe Pluralization

Languages need plural forms: "1 item" vs "2 items". Type-safe i18n models plural categories (like one / other) and requires a count argument so you never forget it.

Plural Categories

The Intl plural rules define categories such as zero, one, two, few, many, other. English uses just one and other; other locales use more.

type PluralCategory = "zero" | "one" | "two" | "few" | "many" | "other";

All lessons in this course

  1. Typing Translation Keys
  2. Interpolation Type Safety
  3. Pluralization with Types
  4. Locale-Aware Type Inference
← Back to TypeScript Academy