```ts
export function accrueFlatInterest(principalCents: number, rateBasisPoints: number, days: number, yearBasis: number): number {
    if (!Number.isInteger(principalCents) || !Number.isInteger(rateBasisPoints) || !Number.isInteger(days) || !Number.isInteger(yearBasis)) {
        throw new Error("All arguments must be whole numbers.");
    }
    if (principalCents < 0 || rateBasisPoints < 0 || days < 0) {
        throw new Error("Principal, rate, and day count must not be negative.");
    }
    if (yearBasis !== 360 && yearBasis !== 365) {
        throw new Error("Year basis must be either 360 or 365.");
    }

    const earnedCents = Math.ceil((principalCents * rateBasisPoints * days) / (10000 * yearBasis));
    return earnedCents;
}
```