ts-fortress
    Preparing search index...

    Type Alias IntRangeInclusive<MinValue, MaxValue>

    IntRangeInclusive: BoolAnd<
        TypeExtends<MinValue, PositiveRange>,
        TypeExtends<MaxValue, PositiveRange>,
    > extends true
        ? UintRangeInclusive<MinValue & Uint11, MaxValue & Uint11>
        : BoolAnd<
            TypeExtends<MinValue, NegativeRange>,
            TypeExtends<MaxValue, PositiveRange>,
        > extends true
            ? NegativeIndex<Abs<MinValue>> | IndexInclusive<MaxValue>
            : BoolAnd<
                TypeExtends<MinValue, PositiveRange>,
                TypeExtends<MaxValue, NegativeRange>,
            > extends true
                ? never
                : BoolAnd<
                    TypeExtends<MinValue, NegativeRange>,
                    TypeExtends<MaxValue, NegativeRange>,
                > extends true
                    ? RelaxedExclude<
                        NegativeIndex<Abs<MinValue>>,
                        NegativesCloserToZeroThan<MaxValue>,
                    >
                    : never

    Creates a union of integer literals starting from MinValue (inclusive) up to MaxValue (inclusive). Unlike UintRangeInclusive, the bounds may be negative.

    Both bounds are limited to the signed 11-bit range (Int11, -1024 to 1023); an inclusive upper bound never needs the extra 1024 that IntRange's exclusive End accepts. Ranges where MinValue > MaxValue (including a positive MinValue with a negative MaxValue) resolve to never.

    Type Parameters

    • MinValue extends Int11

      The starting integer literal (inclusive).

    • MaxValue extends Int11

      The ending integer literal (inclusive).

    A union type MinValue | MinValue + 1 | ... | MaxValue.

    type RI1 = IntRangeInclusive<1, 5>; // 1 | 2 | 3 | 4 | 5
    type RI2 = IntRangeInclusive<-3, 3>; // -3 | -2 | -1 | 0 | 1 | 2 | 3
    type RI3 = IntRangeInclusive<-5, -1>; // -5 | -4 | -3 | -2 | -1
    type RI4 = IntRangeInclusive<3, -3>; // never
    type RI5 = IntRangeInclusive<5, 5>; // 5