ts-fortress
    Preparing search index...

    Variable isBigintConst

    isBigint: (u: unknown) => u is bigint

    Type guard that checks if a value is a bigint.

    Type Narrowing Behavior:

    • Narrows unknown to bigint when true
    • Identifies values created with BigInt() constructor or n suffix

    Type Declaration

      • (u: unknown): u is bigint
      • Parameters

        • u: unknown

          The value to check

        Returns u is bigint

        true if u is a bigint, false otherwise. When true, TypeScript narrows the type to bigint.

    const values: readonly unknown[] = [1n, 2, 3n] as const;

    const bigints = values.filter(isBigint);

    assert.deepStrictEqual(bigints, [1n, 3n]);