bigint
Creates a bigint schema.
const Schema = v.bigint<TMessage>(message);
Generics
TMessageextends ErrorMessage<BigintIssue> | undefined
Parameters
messageTMessage
Explanation
With bigint you can validate the data type of the input. If the input is not a bigint, you can use message to customize the error message.
Returns
SchemaBigintSchema<TMessage>
Examples
The following examples show how bigint can be used.
Force minimum
Schema that forces a minimum bigint value.
const MinBigintSchema = v.pipe(v.bigint(), v.toMinValue(10n));
Validate maximum
Schema that validates a maximum bigint value.
const MaxBigintSchema = v.pipe(v.bigint(), v.maxValue(999n));
Related
The following APIs can be combined with bigint.
Schemas
array, exactOptional, intersect, lazy, looseObject, looseTuple, map, nonNullable, nonNullish, nonOptional, nullable, nullish, object, objectWithRest, optional, record, set, strictObject, strictTuple, tuple, tupleWithRest, undefinedable, union
Methods
assert, config, fallback, getDefault, getDefaults, getFallback, getFallbacks, is, message, parse, parser, pipe, safeParse, safeParser
Actions
check, brand, description, flavor, gtValue, guard, ltValue, maxValue, metadata, minValue, multipleOf, notValue, notValues, rawCheck, rawTransform, readonly, title, toBoolean, toDate, toMaxValue, toMinValue, toNumber, toString, transform, value, values
Utils
entriesFromList, isOfKind, isOfType
© Fabian Hiller
Licensed under the MIT License.
https://valibot.dev/api/bigint/