Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace TB

Index

Type aliases

Append<E, T>: Concat<T, [E]>

Type parameters

  • E

  • T: any[]

Cast<X, Y>: X extends Y ? X : Y

Type parameters

  • X

  • Y

CleanedGaps<T>: { [ K in keyof T]: NonNullable<T[K]> }

Type parameters

  • T: any[]

Concat<T1, T2>: Reverse<Cast<Reverse<T1>, any[]>, T2>

Type parameters

  • T1: any[]

  • T2: any[]

Curry<F>: <T>(...args: Cast<T, Gaps<Parameters<F>>>) => GapsOf<T, Parameters<F>> extends [any, ...any[]] ? Curry<(...args: Cast<GapsOf<T, Parameters<F>>, any[]>) => ReturnType<F>> : ReturnType<F>

Type parameters

  • F: (...args: any) => any

Type declaration

    • <T>(...args: Cast<T, Gaps<Parameters<F>>>): GapsOf<T, Parameters<F>> extends [any, ...any[]] ? Curry<(...args: Cast<GapsOf<T, Parameters<F>>, any[]>) => ReturnType<F>> : ReturnType<F>
    • Type parameters

      • T: any[]

      Parameters

      • Rest ...args: Cast<T, Gaps<Parameters<F>>>

      Returns GapsOf<T, Parameters<F>> extends [any, ...any[]] ? Curry<(...args: Cast<GapsOf<T, Parameters<F>>, any[]>) => ReturnType<F>> : ReturnType<F>

Drop<N, T, I>: Length<I> extends N ? T : Drop<N, Tail<T>, Prepend<any, I>>

Type parameters

  • N: number

  • T: any[]

  • I: any[] = []

GapOf<T1, T2, TN, I>: T1[Pos<I>] extends TB.__ ? Append<T2[Pos<I>], TN> : TN

Type parameters

  • T1: any[]

  • T2: any[]

  • TN: any[]

  • I: any[]

Gaps<T>: CleanedGaps<PartialGaps<T>> extends [...infer A] ? A : never

Type parameters

  • T: any[]

GapsOf<T1, T2, TN, I>: Pos<I> extends Length<T1> ? Concat<TN, Cast<Drop<Pos<I>, T2>, any[]>> : GapsOf<T1, T2, Cast<GapOf<T1, T2, TN, I>, any[]>, Next<I>>

Type parameters

  • T1: any[]

  • T2: any[]

  • TN: any[] = []

  • I: any[] = []

HasTail<T>: Length<T> extends 0 | 1 ? false : true

Type parameters

  • T: any[]

Head<T>: T extends [infer H, ...any[]] ? H : never

Type parameters

  • T: any[]

Last<T>: HasTail<T> extends true ? Last<Tail<T>> : Head<T>

Type parameters

  • T: any[]

Length<T>: T["length"]

Type parameters

  • T: any[]

Next<I>: Prepend<any, I>

Type parameters

  • I: any[]

PartialGaps<T>: { [ K in keyof T]?: T[K] | TB.__ }

Type parameters

  • T: any[]

Pos<I>: Length<I>

Type parameters

  • I: any[]

Prepend<E, T>: [E, ...T]

Type parameters

  • E

  • T: any[]

Prev<I>: Tail<I>

Type parameters

  • I: any[]

Reverse<T, R, I>: Pos<I> extends Length<T> ? R : Reverse<T, Prepend<T[Pos<I>], R>, Next<I>>

Type parameters

  • T: any[]

  • R: any[] = []

  • I: any[] = []

Tail<T>: T extends [any, ...infer TT] ? TT : []

Type parameters

  • T: any[]

Type<A, ID>: A & { [ K in "symbol"]: ID }

Type parameters

  • A: any

  • ID: string

__: Type<{}, "x">