Documentation
    Preparing search index...

    Interface IBranch<Success, StatusValue, BodyData>

    Branch type of propagation.

    IPropagation.IBranch is a branch type composing IPropagation type, which is gathering all possible status codes and their body data types as a union type.

    contracts/common.md#principled-implementation A branch pairs a literal success flag with the status, the data, and the headers, and turns a range spelling into the union of its integers, so a narrowed status is a number the caller can compare.

    contracts/common.md#clear-and-simple-design One record with a conditional on the status member.

    contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.

    contracts/common.md#meaningful-documentation The comment explains that it is the element of the propagation union.

    interface IBranch<Success extends boolean, StatusValue, BodyData> {
        data: BodyData;
        headers: Record<string, string | string[]>;
        status: StatusValue extends "2XX"
        | "3XX"
        | "4XX"
        | "5XX"
            ? StatusRange<StatusValue>
            : StatusValue extends number ? StatusValue : never;
        success: Success;
    }

    Type Parameters

    • Success extends boolean
    • StatusValue
    • BodyData
    Index
    data: BodyData
    headers: Record<string, string | string[]>
    status: StatusValue extends "2XX"
    | "3XX"
    | "4XX"
    | "5XX"
        ? StatusRange<StatusValue>
        : StatusValue extends number ? StatusValue : never
    success: Success