Type Alias Device<Source, MaxLength, PadWith, Result>

Device<Source, MaxLength, PadWith, Result>: Result["length"] extends MaxLength
    ? Source extends []
        ? Result
        : Source extends readonly [...(infer Head), infer Tail]
            ? [Tail, ...Result] extends infer R extends unknown[]
                ? TuplePlus.PadStart.Device<Head, R["length"], PadWith, R>
                : never
            : never
    : Source extends []
        ? TuplePlus.PadStart.Device<Source, MaxLength, PadWith, [PadWith, ...Result]>
        : Source extends readonly [...(infer Head), infer Tail]
            ? TuplePlus.PadStart.Device<Head, MaxLength, PadWith, [Tail, ...Result]>
            : Source

Type Parameters

  • Source extends readonly unknown[]
  • MaxLength extends number
  • PadWith
  • Result extends unknown[]