ts-fortress
    Preparing search index...

    Variable PositiveInt16

    PositiveInt16: {
        add: (
            x: WithSmallInt<PositiveInt16, 40>,
            y: WithSmallInt<PositiveInt16, 40>,
        ) => PositiveInt16;
        div: (
            x: WithSmallInt<PositiveInt16, 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^15": true;
                        "< 2^16": true;
                        "< 2^31": true;
                        "< 2^32": true;
                        "<=0": false;
                        "> -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;
                        },
                    >,
                >,
        ) => PositiveInt16;
        fromNumber: (x: number) => PositiveInt16;
        is: (a: number) => a is PositiveInt16;
        max: (
            ...values: readonly WithSmallInt<PositiveInt16, 40>[],
        ) => PositiveInt16;
        MAX_VALUE: number;
        min: (
            ...values: readonly WithSmallInt<PositiveInt16, 40>[],
        ) => PositiveInt16;
        MIN_VALUE: 1;
        mul: (
            x: WithSmallInt<PositiveInt16, 40>,
            y: WithSmallInt<PositiveInt16, 40>,
        ) => PositiveInt16;
        pow: (
            x: WithSmallInt<PositiveInt16, 40>,
            y: WithSmallInt<PositiveInt16, 40>,
        ) => PositiveInt16;
        random: (
            min?: WithSmallInt<PositiveInt16, 40>,
            max?: WithSmallInt<PositiveInt16, 40>,
        ) => PositiveInt16;
        sub: (
            x: WithSmallInt<PositiveInt16, 40>,
            y: WithSmallInt<PositiveInt16, 40>,
        ) => PositiveInt16;
    }

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

    The PositiveInt16 type represents a positive integer in [1, 2^15). Division (div) uses floor division.

    Type Declaration

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

      Adds two positive integers, returning a + b as a PositiveInt16.

    • Readonlydiv: (
          x: WithSmallInt<PositiveInt16, 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^15": true;
                      "< 2^16": true;
                      "< 2^31": true;
                      "< 2^32": true;
                      "<=0": false;
                      "> -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;
                      },
                  >,
              >,
      ) => PositiveInt16

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

    • ReadonlyfromNumber: (x: number) => PositiveInt16

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

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

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

      Type guard that checks if a value is a positive integer in [1, 2^15).

      isPositiveInt16 for usage examples

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

      Returns the largest of the given positive integers.

    • ReadonlyMAX_VALUE: number

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

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

      Returns the smallest of the given positive integers.

    • ReadonlyMIN_VALUE: 1

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

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

      Multiplies two positive integers, returning a * b as a PositiveInt16.

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

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

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

      Generates a random PositiveInt16 within the given range.

      The range is inclusive on both ends.

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

      Subtracts two positive integers, returning a - b as a PositiveInt16.