ts-data-forge
    Preparing search index...

    Function add

    • Adds two numbers, returning the tightest sound branded result type.

      The sign of the result is computed exactly (e.g. a non-negative plus a non-negative is non-negative); the integer/finite level is preserved, with SafeInt operands widening to Int because the sum may exceed the safe range. No clamping is performed — for a result that stays inside a bounded type, use that type's branded add instead.

      Type Parameters

      • A extends number
      • B extends number

      Parameters

      • a: A

        The first addend.

      • b: B

        The second addend.

      Returns AddResult<A, B>

      a + b, typed as the tightest branded type guaranteed to contain it.