ts-data-forge
    Preparing search index...

    Function isBigint

    • 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

      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: unknown[] = [1n, 2, 3n];

      const bigints = values.filter(isBigint);

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