Creates a type where specified keys K of T are made required (removing the optional ? modifier). The resulting type is a merged intersection for better readability.
K
T
?
The original type (can have optional properties).
The keys to make required.
A new type with keys K made required.
type Data = { a?: number; b?: string; c?: boolean };type PartiallyRequiredData = PartiallyRequired<Data, 'a' | 'b'>;// Result: { a: number; b: string; c?: boolean } Copy
type Data = { a?: number; b?: string; c?: boolean };type PartiallyRequiredData = PartiallyRequired<Data, 'a' | 'b'>;// Result: { a: number; b: string; c?: boolean }
Creates a type where specified keys
KofTare made required (removing the optional?modifier). The resulting type is a merged intersection for better readability.