```ts
export function baseAmount(amount: number, unit: string, defs: Record<string, [number, string]>, base: string): number {
  if (amount < 0 || !Number.isInteger(amount)) {
    throw new Error('Invalid amount. Must be a non-negative whole number.');
  }

  const visited = new Set<string>();

  while (unit !== base) {
    if (visited.has(unit)) {
      throw new Error('Loop detected in unit definitions.');
    }
    visited.add(unit);

    if (!defs.hasOwnProperty(unit)) {
      throw new Error(`Unknown unit: ${unit}`);
    }

    const [factor, finer] = defs[unit];
    if (factor <= 0 || !Number.isInteger(factor)) {
      throw new Error('Invalid factor. Must be a positive whole number.');
    }

    amount *= factor;
    unit = finer;
  }

  return amount;
}
```