Open nmsn opened 1 year ago
Constructs a type consisting of all properties of Type set to required. The opposite of Partial.
interface Props { a?: number; b?: string; } const obj: Props = { a: 5 }; const obj2: Required<Props> = { a: 5 }; // Property 'b' is missing in type '{ a: number; }' but required in type 'Required<Props>'.
https://github1s.com/microsoft/TypeScript/blob/HEAD/lib/lib.es5.d.ts#L1556
/** * Make all properties in T required */ type Required<T> = { [P in keyof T]-?: T[P]; };
Constructs a type consisting of all properties of Type set to required. The opposite of Partial.