Converts any properties whose type includes undefined or null into optional properties typed as T[K] | undefined. Properties whose type does not include undefined or null are left unchanged.
undefined
null
T[K] | undefined
// {name: string; age?: number | undefined; label?: string | null};type Result = SetNullishPropertiesAsOptional<{ name: string; age: number | undefined; label: string | null;}>; Copy
// {name: string; age?: number | undefined; label?: string | null};type Result = SetNullishPropertiesAsOptional<{ name: string; age: number | undefined; label: string | null;}>;
@rest-vir/api
Converts any properties whose type includes
undefinedornullinto optional properties typed asT[K] | undefined. Properties whose type does not includeundefinedornullare left unchanged.