Skip to content

min ​

The number is at least min (inclusive).

Signature ​

ts
function min(min: number, msg?: Message): Action<number>

Parameters ​

ParameterTypeDescription
minnumberMinimum value
msgMessageCustom error message. A string with {params} or a function

Error codes ​

CodeWhenDefault message
minThe number is less than minMust be at least {min}

You can change the texts: see Messages & i18n.

Notes ​

Works with numbers only. For string length use minLength.

Example ​

Price ​

ts
pipe(coerce.number(), min(0))

See also ​