IsInteger<T>
IsInteger<
T
> =T
extendsbigint
?true
:T
extendsnumber
?number
extendsT
?false
:T
extendsPositiveInfinity
|NegativeInfinity
?false
:Not
<IsFloat
<T
>> :false
Defined in: packages/react-querybuilder/src/types/type-fest/is-integer.ts:48
Returns a boolean for whether the given number is an integer, like -5
, 1.0
, or 100
.
Use-case:
- If you want to make a conditional branch based on the result of whether a number is an integer or not.
Type Parameters
Type Parameter |
---|
T |
Example
import type {IsInteger, PositiveInfinity} from "type-fest";
type A = IsInteger<1>;
//=> true
type B = IsInteger<1.0>;
//=> true
type C = IsInteger<-1>;
//=> true
type D = IsInteger<0b10>;
//=> true
type E = IsInteger<0o10>;
//=> true
type F = IsInteger<0x10>;
//=> true
type G = IsInteger<1.23+21>;
//=> true
type H = IsInteger<1.5>;
//=> false
type I = IsInteger<PositiveInfinity>;
//=> false
type J = IsInteger<1e-7>;
//=> false
caution
API documentation is generated from the latest commit on the main
branch. It may be somewhat inconsistent with official releases of React Query Builder.