```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 = Array.from({ length: slots }, () => null);

  return keys.reduce((hits, key) => {
    if (!Number.isInteger(key)) {
      throw new Error("All keys must be integers.");
    }

    const slot = Math.abs(key % slots);
    if (cache[slot] === key) {
      hits++;
    } else {
      cache[slot] = key;
    }
    return hits;
  }, 0);
}
```