Locale-Aware Type Inference
Ensure all locales share the same key structure.
Locale-Aware Type Inference
An app ships multiple locales (en, tr, de...). We want a type that errors when any locale is missing keys present in the base, so translations never silently fall out of sync.
A Base Locale
Pick one locale (usually en) as the canonical key structure. Every other locale must match its shape.
const en = {
greeting: "Hello",
cart: { empty: "Empty", checkout: "Checkout" },
} as const;
type Base = typeof en;All lessons in this course
- Typing Translation Keys
- Interpolation Type Safety
- Pluralization with Types
- Locale-Aware Type Inference