ts-data-forge
    Preparing search index...
    isPositiveInt: (a: number) => a is PositiveInt = is

    Type guard that checks if a value is a positive integer.

    A positive integer is any integer greater than zero (>= 1). This excludes zero, negative numbers, and non-integers.

    Type Declaration

      • (a: number): a is PositiveInt
      • Parameters

        • a: number

        Returns a is PositiveInt

        true if the value is a positive integer, false otherwise

    assert.ok(isPositiveInt(5));
    assert.notOk(isPositiveInt(0));
    assert.ok(PositiveInt.is(10));