Spec-Zone.ru › Valibot

bigint

Creates a bigint schema.

const Schema = v.bigint<TMessage>(message);

Generics

  • TMessage extends ErrorMessage<BigintIssue> | undefined

Parameters

  • message TMessage

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

  • Schema BigintSchema<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/

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API