ts-fortress
    Preparing search index...

    Variable NonNegativeInt32

    NonNegativeInt32: {
        add: (
            x: WithSmallInt<NonNegativeInt32, 40>,
            y: WithSmallInt<NonNegativeInt32, 40>,
        ) => NonNegativeInt32;
        div: (
            x: WithSmallInt<NonNegativeInt32, 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
                | NormalizeBrandUnion<
                    number & {
                        "!=0": true;
                        "< 2^31": true;
                        "< 2^32": true;
                        "> -2^16": true;
                        "> -2^32": true;
                        ">= -2^15": true;
                        ">= -2^31": true;
                        ">=0": true;
                        Finite: true;
                        Int: true;
                        NaNValue: false;
                        SafeInt: true;
                    } & Readonly<
                        {
                            "TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3": unknown;
                        },
                    >,
                >,
        ) => NonNegativeInt32;
        fromNumber: (x: number) => NonNegativeInt32;
        is: (a: number) => a is NonNegativeInt32;
        max: (
            ...values: readonly WithSmallInt<NonNegativeInt32, 40>[],
        ) => NonNegativeInt32;
        MAX_VALUE: number;
        min: (
            ...values: readonly WithSmallInt<NonNegativeInt32, 40>[],
        ) => NonNegativeInt32;
        MIN_VALUE: 0;
        mul: (
            x: WithSmallInt<NonNegativeInt32, 40>,
            y: WithSmallInt<NonNegativeInt32, 40>,
        ) => NonNegativeInt32;
        pow: (
            x: WithSmallInt<NonNegativeInt32, 40>,
            y: WithSmallInt<NonNegativeInt32, 40>,
        ) => NonNegativeInt32;
        random: (
            min?: WithSmallInt<NonNegativeInt32, 40>,
            max?: WithSmallInt<NonNegativeInt32, 40>,
        ) => NonNegativeInt32;
        sub: (
            x: WithSmallInt<NonNegativeInt32, 40>,
            y: WithSmallInt<NonNegativeInt32, 40>,
        ) => NonNegativeInt32;
    }

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

    The NonNegativeInt32 type represents a non-negative integer in [0, 2^31). Division (div) uses floor division.

    Type Declaration

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

      Adds two non-negative integers, returning a + b as a NonNegativeInt32.

    • Readonlydiv: (
          x: WithSmallInt<NonNegativeInt32, 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
              | NormalizeBrandUnion<
                  number & {
                      "!=0": true;
                      "< 2^31": true;
                      "< 2^32": true;
                      "> -2^16": true;
                      "> -2^32": true;
                      ">= -2^15": true;
                      ">= -2^31": true;
                      ">=0": true;
                      Finite: true;
                      Int: true;
                      NaNValue: false;
                      SafeInt: true;
                  } & Readonly<
                      {
                          "TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3": unknown;
                      },
                  >,
              >,
      ) => NonNegativeInt32

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

    • ReadonlyfromNumber: (x: number) => NonNegativeInt32

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

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

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

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

      isNonNegativeInt32 for usage examples

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

      Returns the largest of the given non-negative integers.

    • ReadonlyMAX_VALUE: number

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

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

      Returns the smallest of the given non-negative integers.

    • ReadonlyMIN_VALUE: 0

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

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

      Multiplies two non-negative integers, returning a * b as a NonNegativeInt32.

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

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

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

      Generates a random NonNegativeInt32 within the given range.

      The range is inclusive on both ends.

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

      Subtracts two non-negative integers, returning a - b as a NonNegativeInt32.