Complete worked example
typescript
type FieldErrors<T> = { [K in keyof T]?: string };
type Form = { name: string; count: number };
const errors: FieldErrors<Form> = { count: "Use an integer" };- Reasoning
- The mapped key set follows Form while the output value type deliberately becomes string.