NonNegativeInteger: NonNegative<Integer<T>>

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.

Type Parameters

  • T extends number
  • NonNegative
  • Integer
import type {NonNegativeInteger} from 'type-fest';

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