A common case in applications is to work with types where certain properties are nullable. However, it is also common to need derived types of these same types which are stricter around nullablity of properties.
Let’s imagine a note taking app: We have a `Notebook` type where `id` is nullable because unsaved notebooks haven’t been assigned an `id` yet. However after saving it, we know for a fact that a `Notebook` instance will have an `id` and ideally we shouldn’t have to say `notebook.id!` in the rest of the application.
So, in this post we will explore a generic way to derive types like `SavedNotebook` where certain properties are conditionally mapped to non-optional.