type-plus
    Preparing search index...

    Type Alias PadStart<Tuple, MaxLength, PadWith>

    Pad T with PadWith at the start of the tuple.

    If the MaxLength is less than the length of the tuple, the Tuple will be returned unchanged.

    ⚗️ transform

    Type Parameters

    • Tuple extends readonly unknown[]
    • MaxLength extends number
    • PadWith = unknown
    PadStart<[1, 2, 3], 5, 0> // [0, 0, 1, 2, 3]

    // Ignore if MaxLength is less than the length of the tuple
    PadStart<[1, 2, 3], 2> // [1, 2, 3]

    // Default to unknown
    PadStart<[1, 2, 3], 5> // [unknown, unknown, 1, 2, 3]