Constructs a type by excluding null and undefined from a given type T.
null
undefined
T
The source type which may include null and/or undefined
// With optional propertiesinterface User { name: string; email?: string | null;}type RequiredEmail = NonNullable<User['email']>; // string Copy
// With optional propertiesinterface User { name: string; email?: string | null;}type RequiredEmail = NonNullable<User['email']>; // string
Constructs a type by excluding
nullandundefinedfrom a given typeT.