Type alias PositiveIntegerString<S>

PositiveIntegerString<S>: IfEquals<IsPositiveInteger<Integer<NumerifyString<S>>>, true, Integer<NumerifyString<S>>, never>

Represents a positive integer parsed from a string. If the string does not represent a positive integer, it resolves to never, else it resolves to its integer representation.

Type Parameters

  • S extends string

Example

   PositiveIntegerString<'0'>; // works
PositiveIntegerString<'82739283293237'>; // works
PositiveIntegerString<'82739.283293237'>; // never
PositiveIntegerString<'-82739.283293237'>; // never
PositiveIntegerString<'-1'>; // never