Skip to content

Instantly share code, notes, and snippets.

@fabiospampinato
Created October 15, 2020 20:16
Show Gist options
  • Save fabiospampinato/eb477b12eb5d122ee0a492b85ed89e87 to your computer and use it in GitHub Desktop.
Save fabiospampinato/eb477b12eb5d122ee0a492b85ed89e87 to your computer and use it in GitHub Desktop.
Partial, or total, mess
type _ = {
partial: Partial
};
type Partial = {
/* WITH PLACEHOLDERS */
<T1, R> ( fn: FN<[T1], R>, a1: _ ): FN<[T1], R>,
<T1, T2, R> ( fn: FN<[T1, T2], R>, a1: _ ): FN<[T1, T2], R>,
<T1, T2, R> ( fn: FN<[T1, T2], R>, a1: _, a2: T2 ): FN<[T1], R>,
<T1, T2, R> ( fn: FN<[T1, T2], R>, a1: T1, a2: _ ): FN<[T2], R>,
<T1, T2, R> ( fn: FN<[T1, T2], R>, a1: _, a2: _ ): FN<[T1, T2], R>,
<T1, T2, T3, R> ( fn: FN<[T1, T2, T3], R>, a1: _ ): FN<[T1, T2, T3], R>,
<T1, T2, T3, R> ( fn: FN<[T1, T2, T3], R>, a1: _, a2: T2 ): FN<[T1, T3], R>,
<T1, T2, T3, R> ( fn: FN<[T1, T2, T3], R>, a1: T1, a2: _ ): FN<[T2, T3], R>,
<T1, T2, T3, R> ( fn: FN<[T1, T2, T3], R>, a1: _, a2: _ ): FN<[T1, T2, T3], R>,
<T1, T2, T3, R> ( fn: FN<[T1, T2, T3], R>, a1: _, a2: T2, a3: T3 ): FN<[T1], R>,
<T1, T2, T3, R> ( fn: FN<[T1, T2, T3], R>, a1: T1, a2: _, a3: T3 ): FN<[T2], R>,
<T1, T2, T3, R> ( fn: FN<[T1, T2, T3], R>, a1: T1, a2: T2, a3: _ ): FN<[T3], R>,
<T1, T2, T3, R> ( fn: FN<[T1, T2, T3], R>, a1: _, a2: _, a3: T3 ): FN<[T1, T2], R>,
<T1, T2, T3, R> ( fn: FN<[T1, T2, T3], R>, a1: _, a2: T2, a3: _ ): FN<[T1, T3], R>,
<T1, T2, T3, R> ( fn: FN<[T1, T2, T3], R>, a1: T1, a2: _, a3: _ ): FN<[T2, T3], R>,
<T1, T2, T3, R> ( fn: FN<[T1, T2, T3], R>, a1: _, a2: _, a3: _ ): FN<[T1, T2, T3], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _ ): FN<[T1, T2, T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: T2 ): FN<[T1, T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: T1, a2: _ ): FN<[T2, T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: _ ): FN<[T1, T2, T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: T2, a3: T3 ): FN<[T1, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: T1, a2: _, a3: T3 ): FN<[T2, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: T1, a2: T2, a3: _ ): FN<[T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: _, a3: T3 ): FN<[T1, T2, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: T2, a3: _ ): FN<[T1, T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: T1, a2: _, a3: _ ): FN<[T2, T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: _, a3: _ ): FN<[T1, T2, T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: T2, a3: T3, a4: T4 ): FN<[T1], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: T1, a2: _, a3: T3, a4: T4 ): FN<[T2], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: T1, a2: T2, a3: _, a4: T4 ): FN<[T3], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: T1, a2: T2, a3: T3, a4: _ ): FN<[T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: _, a3: T3, a4: T4 ): FN<[T1, T2], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: T2, a3: _, a4: T4 ): FN<[T1, T3], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: T2, a3: T3, a4: _ ): FN<[T1, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: _, a3: _, a4: T4 ): FN<[T1, T2, T3], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: _, a3: T3, a4: _ ): FN<[T1, T2, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: T2, a3: _, a4: _ ): FN<[T1, T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: T1, a2: _, a3: _, a4: T4 ): FN<[T2, T3], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: T1, a2: _, a3: T3, a4: _ ): FN<[T2, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: T1, a2: T2, a3: _, a4: _ ): FN<[T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: T1, a2: _, a3: _, a4: _ ): FN<[T2, T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: T2, a3: _, a4: _ ): FN<[T1, T3, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: _, a3: T3, a4: _ ): FN<[T1, T2, T4], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: _, a3: _, a4: T4 ): FN<[T1, T2, T3], R>,
<T1, T2, T3, T4, R> ( fn: FN<[T1, T2, T3, T4], R>, a1: _, a2: _, a3: _, a4: _ ): FN<[T1, T2, T3, T4], R>,
/* WITHOUT PLACEHOLDERS */
<HeadArgs extends any[], TailArgs extends any[], Return> ( fn: ( ...args: [...HeadArgs, ...TailArgs] ) => Return, ...headArgs: HeadArgs ): ( ...tailArgs: TailArgs ) => Return,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment