Nullable

This lesson explains the nullable mapped type.

Nullable mapped type

Another possibility with the mapped type is that it can handle null. Similar to the optional Partial<T>, you can create your own Nullable<T>. To create your own type, the first step is to build it with no generic (without <T>, a plain interface or type) and then adjust it by adapting with a generic parameter (e.g. <T>).

Get hands-on with 1200+ tech skills courses.