Custom Mapped Type
This lesson explains how to create your own mapped type.
We'll cover the following
Creating a “NonNullable” type
The first custom type shows how to use never
to tell TypeScript to not compile if a custom map is not respected. The code map is a generic variable that is neither undefined
nor null.
In the case that the value is either one, TypeScript does not compile.
Get hands-on with 1400+ tech skills courses.