ts-type-forge
    Preparing search index...

    Type Alias SmallInt<T, MaxIndex>

    SmallInt: TypeEq<T, "<=0"> extends true
        ? SmallNegativeInt<MaxIndex> | 0
        : TypeEq<T, "<0"> extends true
            ? SmallNegativeInt<MaxIndex>
            : TypeEq<T, ">=0"> extends true
                ? SmallPositiveInt<MaxIndex> | 0
                : TypeEq<T, ">0"> extends true
                    ? SmallPositiveInt<MaxIndex>
                    : TypeEq<T, "!=0"> extends true
                        ? SmallNegativeInt<MaxIndex> | SmallPositiveInt<MaxIndex>
                        : TypeEq<T, ""> extends true
                            ? SmallNegativeInt<MaxIndex> | SmallPositiveInt<MaxIndex> | 0
                            : never

    Union type of small integer literals for type-level operations. Provides literal integer types within a small range for precise typing.

    Type Parameters

    • T extends "!=0" | "" | "<=0" | "<0" | ">=0" | ">0" = ""

      Constraint specifying which integers to include:

      • '' : All integers in [-MaxIndex, MaxIndex - 1]
      • '!=0' : All integers except 0
      • '<0' : Negative integers only [-MaxIndex, -1]
      • '<=0' : Non-positive integers [-MaxIndex, 0]
      • '>0' : Positive integers only [1, MaxIndex - 1]
      • '>=0' : Non-negative integers [0, MaxIndex - 1]
    • MaxIndex extends number = TSTypeForgeInternals_SmallIntIndexMax

      Maximum absolute value for the range (default: 40)

    type DiceValue = SmallInt<'>0', 7>; // 1 | 2 | 3 | 4 | 5 | 6
    type Temperature = SmallInt<'', 101>; // -100 to 100
    type Countdown = SmallInt<'>=0', 11>; // 0 | 1 | 2 | ... | 10
    type Offset = SmallInt<'!=0', 6>; // -5 | -4 | -3 | -2 | -1 | 1 | 2 | 3 | 4 | 5