A non-negative (0 <= x < ∞) number that is an integer. Equivalent to NonNegative<Integer<T>>.
0 <= x < ∞
number
NonNegative<Integer<T>>
You can't pass a bigint as they are already guaranteed to be integers, instead use NonNegative<T>.
bigint
NonNegative<T>
Use-case: Validating and documenting parameters.
import type {NonNegativeInteger} from 'type-fest';declare function setLength<T extends number>(length: NonNegativeInteger<T>): void; Copy
import type {NonNegativeInteger} from 'type-fest';declare function setLength<T extends number>(length: NonNegativeInteger<T>): void;
A non-negative (
0 <= x < ∞)numberthat is an integer. Equivalent toNonNegative<Integer<T>>.You can't pass a
bigintas they are already guaranteed to be integers, instead useNonNegative<T>.Use-case: Validating and documenting parameters.