Utility type that makes the specified keys of an object type nullable (i.e., allows them to be null).
null
Example:
type A = SetNullable<{ a: string; b: number; c: boolean }, "a" | "c">;// Result: { a: string | null; b: number; c: boolean | null } Copy
type A = SetNullable<{ a: string; b: number; c: boolean }, "a" | "c">;// Result: { a: string | null; b: number; c: boolean | null }
If no keys are specified, all properties of the object type will be made nullable.
type B = SetNullable<{ a: string; b: number }>;// Result: { a: string | null; b: number | null } Copy
type B = SetNullable<{ a: string; b: number }>;// Result: { a: string | null; b: number | null }
The base object type.
The keys of the object type to make nullable. Defaults to all keys of the object type.
Utility type that makes the specified keys of an object type nullable (i.e., allows them to be
null
).Example:
If no keys are specified, all properties of the object type will be made nullable.
Example: