ts-fortress
    Preparing search index...

    Variable Int32

    Int32: {
        abs: (
            x: WithSmallInt<Int32, 40>,
        ) => IntersectBrand<Int32, NonNegativeNumber>;
        add: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32;
        div: (
            x: WithSmallInt<Int32, 40>,
            y:
                | 20
                | 1
                | 2
                | 10
                | 3
                | 4
                | 5
                | 6
                | 7
                | 8
                | 9
                | 11
                | 30
                | 18
                | 28
                | 38
                | 12
                | 13
                | 14
                | 15
                | 16
                | 17
                | 19
                | 21
                | 22
                | 23
                | 24
                | 25
                | 26
                | 27
                | 29
                | 31
                | 32
                | 33
                | 34
                | 35
                | 36
                | 37
                | 39
                | -20
                | -1
                | -2
                | -10
                | -3
                | -4
                | -5
                | -6
                | -7
                | -8
                | -9
                | -11
                | -30
                | -40
                | -18
                | -28
                | -38
                | -12
                | -13
                | -14
                | -15
                | -16
                | -17
                | -19
                | -21
                | -22
                | -23
                | -24
                | -25
                | -26
                | -27
                | -29
                | -31
                | -32
                | -33
                | -34
                | -35
                | -36
                | -37
                | -39
                | NormalizeBrandUnion<
                    number & {
                        "!=0": true;
                        "< 2^31": true;
                        "< 2^32": true;
                        "> -2^32": true;
                        ">= -2^31": true;
                        Finite: true;
                        Int: true;
                        NaNValue: false;
                        SafeInt: true;
                    } & Readonly<
                        {
                            "TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3": unknown;
                        },
                    >,
                >,
        ) => Int32;
        fromNumber: (x: number) => Int32;
        is: (a: number) => a is Int32;
        max: (...values: readonly WithSmallInt<Int32, 40>[]) => Int32;
        MAX_VALUE: number;
        min: (...values: readonly WithSmallInt<Int32, 40>[]) => Int32;
        MIN_VALUE: number;
        mul: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32;
        pow: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32;
        random: (
            min?: WithSmallInt<Int32, 40>,
            max?: WithSmallInt<Int32, 40>,
        ) => Int32;
        sub: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32;
    }

    Namespace providing type-safe operations for the Int32 branded type.

    The Int32 type represents an integer in [-2^31, 2^31). Division (div) uses floor division.

    Type Declaration

    • Readonlyabs: (x: WithSmallInt<Int32, 40>) => IntersectBrand<Int32, NonNegativeNumber>

      Returns the absolute value of an integer in [-2^31, 2^31).

      The result is non-negative and keeps the Int32 brand.

    • Readonlyadd: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32

      Adds two integers, returning a + b as an Int32.

    • Readonlydiv: (
          x: WithSmallInt<Int32, 40>,
          y:
              | 20
              | 1
              | 2
              | 10
              | 3
              | 4
              | 5
              | 6
              | 7
              | 8
              | 9
              | 11
              | 30
              | 18
              | 28
              | 38
              | 12
              | 13
              | 14
              | 15
              | 16
              | 17
              | 19
              | 21
              | 22
              | 23
              | 24
              | 25
              | 26
              | 27
              | 29
              | 31
              | 32
              | 33
              | 34
              | 35
              | 36
              | 37
              | 39
              | -20
              | -1
              | -2
              | -10
              | -3
              | -4
              | -5
              | -6
              | -7
              | -8
              | -9
              | -11
              | -30
              | -40
              | -18
              | -28
              | -38
              | -12
              | -13
              | -14
              | -15
              | -16
              | -17
              | -19
              | -21
              | -22
              | -23
              | -24
              | -25
              | -26
              | -27
              | -29
              | -31
              | -32
              | -33
              | -34
              | -35
              | -36
              | -37
              | -39
              | NormalizeBrandUnion<
                  number & {
                      "!=0": true;
                      "< 2^31": true;
                      "< 2^32": true;
                      "> -2^32": true;
                      ">= -2^31": true;
                      Finite: true;
                      Int: true;
                      NaNValue: false;
                      SafeInt: true;
                  } & Readonly<
                      {
                          "TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3": unknown;
                      },
                  >,
              >,
      ) => Int32

      Divides two integers using floor division (⌊a / b⌋): the result is a / b rounded toward negative infinity, as an Int32.

    • ReadonlyfromNumber: (x: number) => Int32

      Converts an arbitrary number into an Int32, rounding to the nearest integer and saturating the result into the range [MIN_VALUE, MAX_VALUE].

      Unlike asInt32, this is total: out-of-range inputs are clamped to the nearest representable Int32 instead of throwing.

    • Readonlyis: (a: number) => a is Int32

      Type guard that checks if a value is an integer in [-2^31, 2^31).

      isInt32 for usage examples

    • Readonlymax: (...values: readonly WithSmallInt<Int32, 40>[]) => Int32

      Returns the largest of the given integers.

    • ReadonlyMAX_VALUE: number

      The largest value representable as Int32 (the upper saturation target of fromNumber).

    • Readonlymin: (...values: readonly WithSmallInt<Int32, 40>[]) => Int32

      Returns the smallest of the given integers.

    • ReadonlyMIN_VALUE: number

      The smallest value representable as Int32 (the lower saturation target of fromNumber).

    • Readonlymul: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32

      Multiplies two integers, returning a * b as an Int32.

    • Readonlypow: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32

      Raises a to the power b, returning a ** b as an Int32 (floored to an integer).

    • Readonlyrandom: (min?: WithSmallInt<Int32, 40>, max?: WithSmallInt<Int32, 40>) => Int32

      Generates a random Int32 within the given range.

      The range is inclusive on both ends.

    • Readonlysub: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32

      Subtracts two integers, returning a - b as an Int32.