Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "api/tuple"

Index

Type aliases

ArrayValue

ArrayValue<T>: T[0]

Returns an array's value type.

Type parameters

  • T: any[]

ButLast

ButLast<T, C>: { 0: ButLast<Tail<T>, Prepend<Head<T>, C>>; 1: Reverse<C> }[IsEmpty<Tail<T>>]

Extracts everything except the last element from a tuple.

Type parameters

  • T: unknown[]

  • C: unknown[]

Head

Head<T>: T extends Parameters<(v: infer R, ...args: any[]) => any> ? R : never

Extracts the first element of a tuple.

Type parameters

  • T: unknown[]

IsEmpty

IsEmpty<T>: T extends [] ? 1 : 0

Returns 1 if T is empty tuple, else 0

Type parameters

  • T: unknown[]

Last

Last<T>: { 0: Last<Tail<T>>; 1: Head<T> }[IsEmpty<Tail<T>>]

Extracts the last element from a tuple.

Type parameters

  • T: unknown[]

Prepend

Prepend<T, U>: Parameters<(v: T, ...args: U) => void>

Adds an element at the start of an tuple.

Type parameters

  • T

  • U: unknown[]

Reverse

Reverse<T>: ReverseReducer<T>

Reverses the order of elements from a tuple.

Type parameters

  • T: unknown[]

ReverseReducer

ReverseReducer<T, C>:

Internal version of Reverse accepting 1 extra argument for the accumulated value.

Type parameters

  • T: unknown[]

  • C: unknown[]

Tail

Tail<T>: ((...a: T) => void) extends (v: any, ...args: infer R) => void ? R : never

Extracts everything except the first element from a tuple.

Type parameters

  • T: unknown[]

Tuple

Tuple<T, N>: [] & { length: N } & Iterable<T>

Defines a fixed sized, iterable tuple with elements of type T and length N.

Type parameters

  • T

  • N: number

TupleLength

TupleLength<T>: T["length"]

Extracts a tuple's length / size.

Type parameters

  • T: unknown[]

Generated using TypeDoc