import { type PrimativeKey, type ReadKeyFunction } from '../key'; import { type Maybe } from '../value/maybe.type'; /** * Configuration for a {@link HashSet}, providing the key extraction function. */ export interface HashSetConfig { /** * Extracts the unique key used for equality comparison from each value. */ readKey: ReadKeyFunction; } /** * Set that is implemented internally using a Map, and input values have their keys read. * * Useful for cases, such as Date, that are unique by a value, but not self. */ export declare class HashSet implements Set { private readonly _map; private readonly _config; /** * @param config - Configuration with the key extraction function. * @param values - Optional initial values to add. */ constructor(config: HashSetConfig, values?: T[]); get config(): HashSetConfig; get size(): number; [Symbol.iterator](): MapIterator; /** * Adds all values from the array to the set. * * @param values - The values to add, or null/undefined to skip. * @returns This set for chaining. */ addAll(values: Maybe): this; add(value: T): this; clear(): void; delete(value: T): boolean; has(value: T): boolean; /** * Checks whether a value with the given key exists in the set. * * @param key - The key to check for. * @returns `true` if a value with this key exists. */ hasKeyValue(key: Maybe): boolean; /** * Returns the value associated with the given key, or undefined if not found. * * @param key - The key to look up. * @returns The value, or undefined. */ valueForKey(key: Maybe): T | undefined; /** * Returns key-value entry pairs for each of the given keys. Missing values appear as undefined. * * @param keys - The keys to look up. * @returns An array of [key, value] tuples. */ valueKeyEntriesForKeys(keys: Maybe[]): [Maybe, Maybe][]; /** * Returns the values associated with the given keys, omitting keys that have no value. * * @param keys - The keys to look up. * @returns An array of found values. */ valuesForKeys(keys: Maybe[]): T[]; forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: unknown): void; entries(): SetIterator<[T, T]>; keys(): SetIterator; values(): SetIterator; /** * Returns all values in the set as an array. * * @returns An array of all stored values. */ valuesArray(): T[]; get [Symbol.toStringTag](): string; }