A numeric type cannot by itself guarantee whole cents. Validate integrality where money enters the typed part of the application.
Worked example
type Brand<T, Name extends string> = T & { readonly __brand: Name };
console.log(
((v: number) =>
Number.isSafeInteger(v) ? (v as Brand<number, "Cents">) : null)(19.5),
);Result
nullImplementation notes
A branded money type becomes useful only when construction goes through the validator. A freely scattered type assertion bypasses that boundary.
Try it yourself
Try zero, a negative whole amount, a fraction and NaN.
Open the TypeScript example →Editorial date December 1, 2026 · Published December 6, 2026