vtils

Home > types > NonNegativeInteger

NonNegativeInteger type

A non-negative (0 <= x < ∞) number that is an integer. Equivalent to NonNegative<Integer<T>>.

You can’t pass a bigint as they are already guaranteed to be integers, instead use NonNegative<T>.

Use-case: Validating and documenting parameters.

Signature:

export declare type NonNegativeInteger<T extends number> = NonNegative<Integer<T>>;

References: NonNegative, Integer

Example

``` import {NonNegativeInteger} from ‘type-fest’;

declare function setLength<T extends number>(length: NonNegativeInteger): void; \`\`\`

Utilities