Recall & Review
beginner
What does the
Partial<T> utility type do in TypeScript?It makes all properties of type
T optional, allowing you to create objects with some or none of the properties defined.Click to reveal answer
beginner
How does
Required<T> utility type affect a type T?It makes all properties of
T required, removing any optional modifiers from the properties.Click to reveal answer
intermediate
What is the result of combining
Partial<T> and Readonly<T> as Readonly<Partial<T>>?You get a type where all properties of
T are optional and cannot be changed after creation (read-only).Click to reveal answer
beginner
Explain what
Pick<T, K> does in TypeScript.It creates a new type by selecting only the properties
K from type T. Useful to focus on specific parts of a type.Click to reveal answer
intermediate
How can you combine
Omit<T, K> and Partial<Pick<T, K>> to make only some properties optional?You can create a type that keeps all properties except
K as they are, and makes only the properties K optional by combining Omit<T, K> with Partial<Pick<T, K>> using intersection (&).Click to reveal answer
What does
Readonly<Partial<T>> do to type T?✗ Incorrect
Combining
Partial makes properties optional, and Readonly makes them read-only.Which utility type would you use to select only some properties from a type?
✗ Incorrect
Pick selects specific properties from a type.How do you make only certain properties optional in a type
T?✗ Incorrect
Combine
Omit<T, K> with Partial<Pick<T, K>> using intersection (&) to make only properties K optional.What does
Required<Partial<T>> result in?✗ Incorrect
Required overrides Partial, so all properties become required.Which utility type removes properties from a type?
✗ Incorrect
Omit creates a type by excluding specified properties.Describe how you can combine utility types to create a type where some properties are optional and others are required.
Think about removing some properties and making only those optional.
You got /5 concepts.
Explain the difference between combining
Partial<Readonly<T>> and Readonly<Partial<T>>.Consider which properties become optional first and then read-only, or vice versa.
You got /4 concepts.