Branded numeric type for non-zero integers. Represents integers that are not equal to zero.
const isNonZeroInt = (x: number): x is NonZeroInt => Number.isInteger(x) && x !== 0;const modulo = (a: Int, b: NonZeroInt) => a % b;const gcd = (a: NonZeroInt, b: NonZeroInt): NonZeroInt => b === 0 ? a : gcd(b, (a % b) as NonZeroInt); Copy
const isNonZeroInt = (x: number): x is NonZeroInt => Number.isInteger(x) && x !== 0;const modulo = (a: Int, b: NonZeroInt) => a % b;const gcd = (a: NonZeroInt, b: NonZeroInt): NonZeroInt => b === 0 ? a : gcd(b, (a % b) as NonZeroInt);
Branded numeric type for non-zero integers. Represents integers that are not equal to zero.