Skip to content

Function: Range() ​

ts
function 
Range
(
min
,
max
):
TypeFunction
<number>;

Defined in: packages/advanced-types/src/index.ts:49

Creates a range type function that validates the input is a number within the specified range.

Parameters ​

ParameterTypeDescription

min

number

The minimum acceptable value (inclusive)

max

number

The maximum acceptable value (inclusive)

Returns ​

TypeFunction<number>

A TypeFunction that validates the input value

Throws ​

If the value is not a number or is outside the specified range

在 MIT 许可证下发布