Creates a type that enforces at least one member of a union U
to be present, while keeping the other possible properties optional.
Each variant in the resulting type corresponds to one union member
whose keys are required, while the remaining members’ keys are optional
but still properly typed.
Example:
type U = { a: number } | { b: string };
RequireAtLeastOneFromUnion →
| { a: number; b?: string }
| { b: string; a?: number }
Creates a type that enforces at least one member of a union
U
to be present, while keeping the other possible properties optional.Each variant in the resulting type corresponds to one union member whose keys are required, while the remaining members’ keys are optional but still properly typed.
Example: type U = { a: number } | { b: string }; RequireAtLeastOneFromUnion → | { a: number; b?: string } | { b: string; a?: number }