Aller au contenu principal

coerceBigInt()

coerceBigInt(message?): BigIntConstraint

Coerce BigInt schema - converts values to bigint with constraints.

Handles conversion from number, string, boolean, and other types to BigInt. Returns the coerced value directly for optimal performance.


Parameters​

message?: string​

Custom error message


Returns: BigIntConstraint​

Schema that converts to bigint with chainable constraints.


Since​

2.0.0


Example​

// Basic coercion
coerceBigInt()

// With constraints
coerceBigInt().min(0n).max(100n)
coerceBigInt().positive()