```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');
    if (!(unit in defs) && unit !== base) throw new Error('Unknown unit');
    if (defs[base]) throw new Error('Base unit should not have a definition');

    let currentUnit = unit;
    while (currentUnit !== base) {
        const [factor, finer] = defs[currentUnit];
        if (factor <= 0 || !Number.isInteger(factor)) throw new Error('Invalid factor');
        amount *= factor;
        currentUnit = finer;
    }

    return amount;
}
```