API reference › @evolu/common › Type › lessThanBigInt
function lessThanBigInt<Max extends bigint>(
max: ValidateBrandFactoryBigInt<Max>,
): BrandFactory<`LessThan${Max}n`, bigint, LessThanBigIntError<Max>>;
Defined in: packages/common/src/Type.ts:12556
Bigint Brand requiring a value less than max.
The bigint counterpart of lessThan; see greaterThanBigInt. For
negative bigints, use lessThanBigInt(0n).
Example
import { assertErr, assertOk, BigInt, lessThanBigInt } from "@evolu/common";
const Negative = lessThanBigInt(0n)(BigInt);
assertOk(Negative.fromUnknown(-1n), -1n);
assertErr(Negative.fromUnknown(0n), {
type: "LessThan0n",
value: 0n,
max: 0n,
});