Skip to main content
Module

x/rimbu/typical/mod.ts>StrNum.PosNum

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
type alias StrNum.PosNum
import { type StrNum } from "https://deno.land/x/rimbu@0.12.3/typical/mod.ts";
const { PosNum } = StrNum;

Type that will return the incoming type if the value is a valid positive integer, or never otherwise.

Examples

Example 1

PosNum<'321'> => '321'
PosNum<'0'> => never

Type Parameters

N extends string
definition: N extends Str.Append<PosDigit, infer Rest> ? Rest extends Str.TakeWhile<Rest, Digit> ? N : never : never