nonCountable
function nonCountable<T>(value: T | number): value is T;
nonCountable(value) is the same test as !isCountable(value), written so that a guard clause reads as a sentence rather than as a negation.
A value that can serve as a quantity, a length or a zero-based index: a whole number, not negative, and small enough that integer arithmetic on it is still exact.
isX and nonX answer a question and never interrupt control flow; requireX and requireNonX hand the value back or throw. The scheme is explained in Validation conventions.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The value to check. |
Returns
boolean — true when the value is not a countable number; otherwise false.
In TypeScript the guard narrows value to T inside the branch.
Examples
What passes and what does not
nonCountable(-1); // => true
nonCountable(1.5); // => true
nonCountable(Number.MAX_SAFE_INTEGER + 2); // => true
nonCountable(0); // => false
nonCountable(42); // => false
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.