Skip to content

NumberConstraints

Runtime numeric constraints attached to a number flag/arg schema.

Bounds are inclusive. All fields are optional; an absent field means "no constraint" except for finite, which defaults to true (so Infinity / -Infinity are rejected unless opted back in).

Signatures

ts
interface NumberConstraints {}

Members

Properties

finite

Require a finite value. When true, Infinity / -Infinity are rejected.

ts
finite?: boolean;

int

Require an integer value. Non-integers (e.g. 3.7) are rejected.

ts
int?: boolean;

max

Inclusive upper bound. Values above this are rejected.

ts
max?: number;

min

Inclusive lower bound. Values below this are rejected.

ts
min?: number;

See Also

Released under the MIT License.