TypeScript · Junior · Question 49 of 75
How does Required<T> differ from Partial<T>?
- ✓Correct answer:
Requiredmakes all properties required,Partialmakes them optional - 2
Requiredremoves thereadonlymodifier, whilePartialadds it - 3They're synonyms: both make an object's properties required
Explanation
They're opposites: Required removes the ? modifier, Partial adds it. readonly is handled by Readonly<T>. All these utilities are mapped types that you can write yourself.