Construct a Deep Partial of an Object
Partials allow you to construct types where some of the higher-level properties are optional. The idea of a DeepPartial takes this further by allowing all of the properties to become optional.
This is useful for when you want to be able to include just some parts of a type.
MyType below, which has several properties at various levels:
0:00 In this exercise, we're going to be creating a deep partial type helper, which takes in a type here and returns a partial version of that type. In other words, all of the members of the objects are going to be undefined, and even works inside arrays and inside other objects too. This should work to any depth, basically. It should keep recursively going down and down.
0:28 thing that might help you here is thinking that, inside a type, you can reuse that type if you want to. You're probably going to need a conditional type here. We're going to be wanting to recursively call deep partial further and further down the tree as we go.
0:46 This one's going to be tricky conceptually to get your head around, but we're going to need a conditional type, probably going to need a partial type helper too. There is maybe one thing that you haven't seen before. Do check in the docs around map types for that. Best of luck.