ts-type-forge
    Preparing search index...
    NegativeIndex: MapIdx<RelaxedExclude<IndexInclusive<N>, 0>>

    Creates a union of negative integer literals from -1 down to (and including) -N. Equivalent to -1 | -2 | ... | -N. Requires N to be a non-negative integer literal.

    Type Parameters

    • N extends number

      The absolute value of the lower bound (inclusive). Must be a non-negative integer literal.

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

    type NegIdx3 = NegativeIndex<3>; // -1 | -2 | -3
    type NegIdx0 = NegativeIndex<0>; // never
    type NegIdx1 = NegativeIndex<1>; // -1