Hyperlinkv0.8.0-beta.28

SchemaGetter

SchemaGetter.BigIntfunctioneffect/SchemaGetter.ts:761
<E extends string | number | bigint | boolean>(): Getter<bigint, E>

Coerces a value to bigint using the global BigInt() constructor.

When to use

Use when you need a schema getter to convert a present string, number, or boolean value to bigint.

Details

  • Delegates to globalThis.BigInt.
  • Throws at runtime if the input cannot be converted (e.g. non-numeric string).

Example (Coercing to a bigint)

import { SchemaGetter } from "effect"

const toBigInt = SchemaGetter.BigInt<string>()
// Getter<bigint, string>
Coercions
export function BigInt<E extends string | number | bigint | boolean>(): Getter<bigint, E> {
  return transform(globalThis.BigInt)
}
Referenced by 1 symbols