Type Alias IsInteger<T, $O>

IsInteger<T, $O>: IsNumber<T, {
        $else: $Else;
        $then: $Then;
        distributive: $O["distributive"];
    }> extends infer R
    ? R extends $Then
        ? number extends T
            ? $ResolveBranch<number, $O, [$Then]> | $ResolveBranch<T, $O, [$Else]>
            : T extends number & infer U
                ? `${T}` extends `${number}.${number}`
                    ? $ResolveBranch<T, $O, [$Else]>
                    : [T, U] extends [U, T]
                        ? $ResolveBranch<T, $O, [$Then]>
                        : $ResolveBranch<number, $O, [$Then]> | $ResolveBranch<T, $O, [$Else]>
                : never
        : R extends $Else
            ? IsBigint<T, {
                    $else: $Else;
                    $then: $Then;
                    distributive: $O["distributive"];
                }> extends infer R
                ? R extends $Then
                    ? $ResolveBranch<T, $O, [$Then]>
                    : $ResolveBranch<T, $O, [$Else]>
                : never
            : never
    : never

Is T an integer, including bigint.

type R = IsInteger<0> // true
type R = IsInteger<1n> // true

type R = IsInteger<1.1> // false
type R = IsInteger<number> // false as it contains non-integer

Type Parameters