Type guard that checks if a value is a bigint.
Type Narrowing Behavior:
unknown
bigint
true
BigInt()
n
The value to check
true if u is a bigint, false otherwise. When true, TypeScript narrows the type to bigint.
u
false
const values: unknown[] = [1n, 2, 3n];const bigints = values.filter(isBigint);assert.deepStrictEqual(bigints, [1n, 3n]); Copy
const values: unknown[] = [1n, 2, 3n];const bigints = values.filter(isBigint);assert.deepStrictEqual(bigints, [1n, 3n]);
Type guard that checks if a value is a bigint.
Type Narrowing Behavior:
unknown
tobigint
whentrue
BigInt()
constructor orn
suffix