pronotron-tech-art-suite
    Preparing search index...

    Type Alias RequireAtLeastOneFromUnion<U>

    RequireAtLeastOneFromUnion: U extends any
        ? U & Partial<Pick<MergedProps<U>, Exclude<KeysOfUnion<U>, keyof U>>>
        : never

    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 }

    Type Parameters

    • U extends object