```typescript
export function slotHits(keys: number[], slots: number): number {
  if (!Number.isInteger(slots) || slots <= 0) {
    throw new Error("Slot count must be a positive integer.");
  }

  const cache: Set<number>[] = Array.from({ length: slots }, () => new Set());

  let hits = 0;
  for (const key of keys) {
    if (!Number.isInteger(key)) {
      throw new Error("Keys must be integers.");
    }

    const slot = Math.abs(key % slots);
    if (cache[slot].has(key)) {
      hits++;
      cache[slot].delete(key);
    }
    cache[slot].add(key);
  }

  return hits;
}
```