Interpolation Type Safety
Extract and require interpolation variables from strings.
Type-Safe Interpolation
Messages often contain placeholders like "Hello, {name}". Type-safe i18n extracts those placeholder names from the message string type and requires you to pass matching arguments.
The Goal
Given the literal type of a message, we want to compute the object of variables it needs, so t("greet", { name: "Ada" }) is enforced and a missing name is a compile error.
All lessons in this course
- Typing Translation Keys
- Interpolation Type Safety
- Pluralization with Types
- Locale-Aware Type Inference