Required Utility Type
What
The Required<T> utility type is the opposite of Partial. It takes a type and ensures that every property—even those originally marked with a ?—must be present.
How
You wrap the target type in Required:
interface BlogPost {
title: string;
tags?: string[]; // Optional
}
// Both title and tags are now strictly required
type FinalizedPost = Required<BlogPost>;
Why
Required is useful for validation stages. You might allow a “draft” object to have optional fields, but once that object moves to a “publishing” or “billing” phase, you can use Required to ensure that the compiler enforces the presence of all necessary data.
Summary
Use Required<T> to enforce a fully populated data structure for critical operations.