import { If } from "./if"; import { IfNot } from "./if-not"; import { IsNever } from "./never"; import { Not } from "./not"; export type OddDigit = "1" | "3" | "5" | "7" | "9"; export type EvenDigit = "0" | "2" | "4" | "6" | "8"; export type Integer = `${T}` extends `${string}.${string}` ? never : T; export type Float = If>, T, never>; export type Negative = `${T}` extends `-${string}` ? T : never; export type Positive = If>, T, never>; export type PositiveInteger = Positive>; export type NegativeInteger = Negative>; export type PositiveFloat = Positive>; export type NegativeFloat = Negative>; export type Even = IfNot< IsNever>, `${T}` extends `${string}${EvenDigit}` ? T : never, never >; export type Odd = IfNot< IsNever>, If>, T, never>, never >; export type IsInteger = Not>>; export type IsFloat = Not>>; export type IsEven = If< IsInteger, `${T}` extends `${string}${EvenDigit}` ? true : false >; export type IsOdd = If, Not>>; export type IsPositive = Not>>; export type IsNegative = Not>>; export type IsPositiveInteger = Not< IsNever> >; export type IsNegativeInteger = Not< IsNever> >; export type IsPositiveFloat = Not>>; export type IsNegativeFloat = Not>>; export type IfInteger = If< IsInteger, IfTrue, IfFalse >; export type IfFloat = If< IsFloat, IfTrue, IfFalse >; export type IfEven = If< IsEven, IfTrue, IfFalse >; export type IfOdd = If< IsOdd, IfTrue, IfFalse >; export type IfPositive = If< IsPositive, IfTrue, IfFalse >; export type IfNegative = If< IsNegative, IfTrue, IfFalse >; export type IfPositiveInteger< T extends number, IfTrue = true, IfFalse = false > = If, IfTrue, IfFalse>; export type IfNegativeInteger< T extends number, IfTrue = true, IfFalse = false > = If, IfTrue, IfFalse>; export type IfPositiveFloat< T extends number, IfTrue = true, IfFalse = false > = If, IfTrue, IfFalse>; export type IfNegativeFloat< T extends number, IfTrue = true, IfFalse = false > = If, IfTrue, IfFalse>; export type ParseNumber = T extends `${infer NumT extends number}` ? NumT : never; export type Abs = `${T}` extends `-${infer PositiveT extends number}` ? PositiveT : T; export type Negate = ParseNumber<`-${Abs}`>;