Creates a type where specified keys K of T are made nullable (i.e., | undefined is added to their type). The resulting type is a merged intersection for better readability.
K
T
| undefined
The original type.
The keys to make nullable.
A new type with keys K made nullable.
type Data = { a: number; b: string; c: boolean };type PartiallyNullableData = PartiallyNullable<Data, 'a' | 'b'>;// Result: { a: number | undefined; b: string | undefined; c: boolean } Copy
type Data = { a: number; b: string; c: boolean };type PartiallyNullableData = PartiallyNullable<Data, 'a' | 'b'>;// Result: { a: number | undefined; b: string | undefined; c: boolean }
Creates a type where specified keys
KofTare made nullable (i.e.,| undefinedis added to their type). The resulting type is a merged intersection for better readability.