TypeScript · Junior · Question 17 of 75
What does the utility type Partial<User> do?
- ✓Correct answer: Makes all properties of
Useroptional - 2Keeps only some properties, specified by the second parameter
- 3Makes all properties of
Userread-only
Explanation
Partial<T> adds ? to every property - handy for update objects: update(id, patch: Partial<User>). Selecting a subset is Pick, read-only is Readonly, all required is Required.