ts-type-forge
    Preparing search index...

    Creates a union of non-negative integer literals from 0 up to (but not including) N. Equivalent to 0 | 1 | ... | N-1. Requires N to be a non-negative integer literal.

    Type Parameters

    • N extends number

      The upper bound (exclusive). Must be a non-negative integer literal.

    A union type 0 | 1 | ... | N-1. Returns never if N is 0.

    type Idx3 = Index<3>; // 0 | 1 | 2
    type Idx0 = Index<0>; // never
    type Idx1 = Index<1>; // 0