export interface Curried < A , B , T > { ( a ) : ( b : B ) => T ; ( a , b ) : T ; } export function curry2 < A , B , T > ( fn ) { function curried ( a ) ; function curried ( a , b ) ; function curried ( a , ... b ) { if ( b . length === 0 ) { return b => fn ( a , b ) ; } else { return fn ( a , ... b ) ; } } return curried ; }