Skip to content

Function: integer() ​

WARNING

This API is experimental and may change in future versions.

Create an integer argument schema with optional range validation.

Only accepts integer values (no decimals).

Signature ​

ts
declare function integer(opts?: IntegerOptions): CombinatorSchema<number>

Parameters ​

NameTypeDescription
optsIntegerOptionsRange options. (optional)

Returns ​

CombinatorSchema<number> — A combinator schema that resolves to number (integer).

Examples ​

ts
const args = {
  retries: integer({ min: 0, max: 10 })
}

Released under the MIT License.