Branded numeric type for positive integers. Represents integers strictly greater than zero.
const isPositiveInt = (x: number): x is PositiveInt => Number.isInteger(x) && x > 0;const take = <T>(arr: readonly T[], n: PositiveInt): T[] => arr.slice(0, n);const id = (value: PositiveInt) => ({ id: value }); Copy
const isPositiveInt = (x: number): x is PositiveInt => Number.isInteger(x) && x > 0;const take = <T>(arr: readonly T[], n: PositiveInt): T[] => arr.slice(0, n);const id = (value: PositiveInt) => ({ id: value });
Branded numeric type for positive integers. Represents integers strictly greater than zero.