(u: unknown): u is bigintChecks whether a value is a bigint.
When to use
Use to validate unknown input and narrow it to bigint.
Example (Checking for bigints)
import { BigInt } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(BigInt.isBigInt(1n), true)
assert.deepStrictEqual(BigInt.isBigInt(1), false)guards
Source effect/BigInt.ts:781 lines
export const const isBigInt: (
u: unknown
) => u is bigint
Checks whether a value is a bigint.
When to use
Use to validate unknown input and narrow it to bigint.
Example (Checking for bigints)
import { BigInt } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(BigInt.isBigInt(1n), true)
assert.deepStrictEqual(BigInt.isBigInt(1), false)
isBigInt: (u: unknownu: unknown) => u: unknownu is bigint = import predicatepredicate.function isBigInt(
input: unknown
): input is bigint
Checks whether a value is a bigint.
When to use
Use when you need a Predicate guard to narrow an unknown value to a
bigint.
Details
Uses typeof input === "bigint".
Example (Guarding bigints)
import { Predicate } from "effect"
const data: unknown = 1n
if (Predicate.isBigInt(data)) {
console.log(data + 2n)
}
isBigInt