Type alias MakeNullishOptional<T>

MakeNullishOptional<T>: Optional<T, NullishPropertiesOf<T>>

Makes all shallow properties of an object optional if they accept undefined or null as a value.

Example

type MyOptionalType = MakeUndefinedOptional<{
id: number | undefined,
firstName: string,
lastName: string | null,
}>;

// is equal to

type MyOptionalType = {
// this property is optional.
id?: number | undefined,
firstName: string,
// this property is optional.
lastName?: string | null,
};

Type Parameters

  • T extends object

Generated using TypeDoc