Type Alias Abs<N, Fail>

Abs<N, Fail>: IsNumber<N, NumberPlus.IsNumber.$Branch> extends infer R
    ? R extends $Then
        ? [number] extends [N]
            ? Fail
            : `${N}` extends `-${infer P extends number}`
                ? P
                : N
        : R extends $Else
            ? IsBigint<N> extends infer R
                ? R extends true
                    ? [bigint] extends [N]
                        ? Fail
                        : `${N}` extends `-${infer P extends bigint}`
                            ? P
                            : N
                    : Fail
                : never
            : never
    : never

Type Parameters

  • N extends number | bigint
  • Fail = never