Skip to content

Inc

Since 1.1.0

Increment a number type by 1.

Signature

typescript
type Inc<N extends number> = [...NumberToArray<N>, 0]['length']

Parameters

ParameterDescription
NThe number to increment

Examples

Basic Usage

typescript
import type { Inc } from 'uni-types'

type A = Inc<5>   // 6
type B = Inc<0>   // 1
type C = Inc<10>  // 11
  • Dec - Decrement a number
  • Add - Add two numbers

Released under the MIT License.