/** * TypeScript implementation of Python's built-in hash() function. * * Matches CPython for: * • int / bigint — exact * • float — exact * • bool — exact (True → 1, False → 0) * • str — exact when PYTHONHASHSEED=0; Python randomises by default * • tuple — exact, CPython 3.8+ xxHash-based algorithm * (pass a readonly array to represent a tuple) * * hash(None) is intentionally unsupported: Python derives it from object * identity (memory address), which cannot be replicated portably. */ type Hashable = number | bigint | string | boolean | readonly Hashable[]; /** * Compute Python's `hash()` for the given value. * * Supports: `boolean`, `number` (int & float), `bigint`, `string`, and tuples * (represented as `readonly` arrays). * * **String hashing** is deterministic only when `PYTHONHASHSEED=0`. * Python randomises string hashes by default, so results will differ from a * live Python session unless you `export PYTHONHASHSEED=0` before running it. */ declare function hash(value: Hashable): number; export { type Hashable, hash };